summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Platform.WinRT/CellControl.cs
diff options
context:
space:
mode:
authorSamantha Houts <samantha@teamredwall.com>2016-06-17 03:10:18 -0700
committerRui Marinho <me@ruimarinho.net>2016-06-17 11:10:18 +0100
commit925fc0aa588a060eb23fa16c1d225dd030012c23 (patch)
tree83676c25c29d97d9250516b217020ba85425796d /Xamarin.Forms.Platform.WinRT/CellControl.cs
parentd44396a4534b1e2bc81143c809e4adaee656ab15 (diff)
downloadxamarin-forms-925fc0aa588a060eb23fa16c1d225dd030012c23.tar.gz
xamarin-forms-925fc0aa588a060eb23fa16c1d225dd030012c23.tar.bz2
xamarin-forms-925fc0aa588a060eb23fa16c1d225dd030012c23.zip
Prep Cell & friends for removal of InternalsVisibleTo (#142)
* Prep Cell & friends for removal of InternalsVisibleTo Includes: - Cell - EntryCell - ListView - MenuItem - TableView - ViewCell - Toolbar Moved extensions to Internal & removed TPH * Update docs * [Controls] Ignore Issue2411 on iOS <9 * [Controls] Formatting for Issue2411
Diffstat (limited to 'Xamarin.Forms.Platform.WinRT/CellControl.cs')
-rw-r--r--Xamarin.Forms.Platform.WinRT/CellControl.cs40
1 files changed, 9 insertions, 31 deletions
diff --git a/Xamarin.Forms.Platform.WinRT/CellControl.cs b/Xamarin.Forms.Platform.WinRT/CellControl.cs
index a47c9646..31f29902 100644
--- a/Xamarin.Forms.Platform.WinRT/CellControl.cs
+++ b/Xamarin.Forms.Platform.WinRT/CellControl.cs
@@ -8,6 +8,7 @@ using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
+using Xamarin.Forms.Internals;
#if WINDOWS_UWP
@@ -41,7 +42,7 @@ namespace Xamarin.Forms.Platform.WinRT
Unloaded += (sender, args) =>
{
- Cell cell = Cell;
+ ICellController cell = Cell;
if (cell != null)
cell.SendDisappearing();
};
@@ -110,28 +111,6 @@ namespace Xamarin.Forms.Platform.WinRT
return result;
}
- static string GetDisplayTextFromGroup(ListView lv, TemplatedItemsList<ItemsView<Cell>, Cell> group)
- {
- string displayBinding = null;
-
- if (lv.GroupDisplayBinding != null)
- displayBinding = group.Name;
-
- if (lv.GroupShortNameBinding != null)
- displayBinding = group.ShortName;
-
- // TODO: what if they set both? should it default to the ShortName, like it will here?
- // ShortNames binding did not appear to be functional before.
- return displayBinding;
- }
-
- static TemplatedItemsList<ItemsView<Cell>, Cell> GetGroup(object newContext, ListView lv)
- {
- int groupIndex = lv.TemplatedItems.GetGlobalIndexOfGroup(newContext);
- TemplatedItemsList<ItemsView<Cell>, Cell> group = lv.TemplatedItems.GetGroup(groupIndex);
- return group;
- }
-
ListView GetListView()
{
DependencyObject parent = VisualTreeHelper.GetParent(this);
@@ -251,13 +230,12 @@ namespace Xamarin.Forms.Platform.WinRT
{
string textContent = newContext.ToString();
+ IListViewController listViewController = lv;
+
if (isGroupHeader)
- {
- TemplatedItemsList<ItemsView<Cell>, Cell> group = GetGroup(newContext, lv);
- textContent = GetDisplayTextFromGroup(lv, group);
- }
+ textContent = listViewController.GetDisplayTextFromGroup(newContext);
- cell = lv.CreateDefaultCell(textContent);
+ cell = listViewController.CreateDefaultCell(textContent);
}
// A TableView cell should already have its parent,
@@ -266,7 +244,7 @@ namespace Xamarin.Forms.Platform.WinRT
// This provides the Group Header styling (e.g., larger font, etc.) when the
// template is loaded later.
- TemplatedItemsList<ItemsView<Cell>, Cell>.SetIsGroupHeader(cell, isGroupHeader);
+ cell.SetIsGroupHeader<ItemsView<Cell>, Cell>(isGroupHeader);
}
Cell = cell;
@@ -277,12 +255,12 @@ namespace Xamarin.Forms.Platform.WinRT
if (oldCell != null)
{
oldCell.PropertyChanged -= _propertyChangedHandler;
- oldCell.SendDisappearing();
+ ((ICellController)oldCell).SendDisappearing();
}
if (newCell != null)
{
- newCell.SendAppearing();
+ ((ICellController)newCell).SendAppearing();
UpdateContent(newCell);
SetupContextMenu();