[Preserve(AllMembers = true)]
public class CustomViewCell : ViewCell
{
-
public CustomViewCell ()
{
int tapsFired = 0;
Text = "I have been selected:"
};
+ if (this is CustomViewCellBindingContext)
+ label.Text = "If you can read this text the UI Test has failed";
+
Tapped += (s, e) => {
tapsFired++;
label.Text = "I have been selected:" + tapsFired;
+
+ var cell = (CustomViewCell)s;
};
View = label;
}
}
+
+
+ [Preserve(AllMembers = true)]
+ public class CustomViewCellBindingContext : CustomViewCell
+ {
+ public CustomViewCellBindingContext()
+ {
+ }
+ }
+
#if UITEST
[NUnit.Framework.Category(Core.UITests.UITestCategories.UwpIgnore)]
#endif
Title = "List Page";
var items = new [] {
- new CustomViewCell (),
+ new CustomViewCellBindingContext()
};
var cellTemplate = new DataTemplate (typeof(CustomViewCell));
List.SelectedIndex = index;
}
- void OnListItemClicked(int index, Cell cell = null)
+ void OnListItemClicked(int index)
{
- Element.NotifyRowTapped(index, cell);
+ Element.NotifyRowTapped(index);
_itemWasClicked = true;
}
var templatedItems = TemplatedItemsView.TemplatedItems;
var selectedItemIndex = templatedItems.GetGlobalIndexOfItem(e.ClickedItem);
- OnListItemClicked(selectedItemIndex, e.ClickedItem as Cell);
+ OnListItemClicked(selectedItemIndex);
}
}