public ContextActionsGallery(bool tableView = false, bool hasUnevenRows = false, int messagesCount = 100) { BindingContext = new MessagesViewModel(messagesCount); View list; if (!tableView) { list = new ListView { HasUnevenRows = hasUnevenRows }; list.SetBinding(ListView.ItemsSourceProperty, "Messages"); ((ListView)list).ItemTemplate = new DataTemplate(typeof(MessageCell)); } else { var section = new TableSection(); section.Add(new TextCell { Text = "I have no ContextActions", Detail = "Sup" }); foreach (var msg in ((MessagesViewModel)BindingContext).Messages) { section.Add(new MessageCell { BindingContext = msg }); } list = new TableView(); ((TableView)list).Root = new TableRoot { section }; } Content = new StackLayout { Children = { new Label { Text = "Email" }, list } }; }
public ContextActionsGallery (bool tableView = false) { BindingContext = new MessagesViewModel(); View list; if (!tableView) { list = new ListView(); list.SetBinding (ListView.ItemsSourceProperty, "Messages"); ((ListView)list).ItemTemplate = new DataTemplate (typeof (MessageCell)); } else { var section = new TableSection(); section.Add (new TextCell { Text = "I have no ContextActions", Detail = "Sup" }); foreach (var msg in ((MessagesViewModel) BindingContext).Messages) { section.Add (new MessageCell { BindingContext = msg }); } list = new TableView(); ((TableView)list).Root = new TableRoot { section }; } Content = new StackLayout { Children = { new Label { Text = "Email" }, list } }; }