public override void ViewDidLoad() { base.ViewDidLoad(); this.source = new GroupedListSource(); this.source.TableView = this.TableView; // Register the TableView's data source this.TableView.Source = this.source; var groups = new List<IGroup>(); var section1 = new GroupViewModel(); section1.Header = new CaptionViewModel("Samples"); groups.Add(section1); section1.Rows.Add(new StringElementViewModel("Simple Binding") { TapCommand = new DelegateCommand(() => { this.NavigationController.PushViewController(new SimpleBindingViewController(), true); }) }); section1.Rows.Add(new StringElementViewModel("Simple List") { TapCommand = new DelegateCommand(() => { this.NavigationController.PushViewController(new SimpleListController(), true); }) }); section1.Rows.Add(new StringElementViewModel("Wrapped View Model Binding To List") { TapCommand = new DelegateCommand(() => { this.NavigationController.PushViewController(new SimpleViewModelController(), true); }) }); section1.Rows.Add(new StringElementViewModel("Widget Samples") { TapCommand = new DelegateCommand(() => { this.NavigationController.PushViewController(new WidgetSampleController(), true); }) }); this.source.Bind(groups); }
public TestCommandRowViewModel(GroupViewModel group, string caption) : base(caption) { this.group = group; this.TapCommand = new DelegateCommand(() => { this.group.Rows.Add(new CaptionViewModel("added")); }); }
public static IList<IGroup> GetViewModel() { var groups = new ObservableCollection<IGroup>(); var section1 = new GroupViewModel(); section1.Header = new HeaderElementViewModel("Header 1"); groups.Add(section1); section1.Rows.Add(new TestCommandRowViewModel(section1, "add")); section1.Rows.Add(new StringElementViewModel("update") { TapCommand = new DelegateCommand(() => { ((CaptionViewModel)section1.Rows[1]).Caption = "Updated!"; }) }); section1.Rows.Add(new CaptionViewModel("item 1")); section1.Rows.Add(new CaptionViewModel("item 2")); groups.Add(new GroupViewModel()); groups[1].Rows.Add(new CaptionViewModel("item 1")); groups[1].Rows.Add(new CaptionViewModel("item 3")); groups[1].Rows.Add(new CaptionViewModel("item 2")); groups[1].Header = new HeaderElementViewModel("Header 2"); groups[1].Footer = new CaptionViewModel("Footer 2"); groups.Add(new GroupViewModel()); groups[2].Header = new CaptionViewModel("Header 3"); for (int i = 0; i < 100; i++) { groups[2].Rows.Add(new CaptionViewModel("item " + i.ToString())); } return groups; }
public override void ViewDidLoad() { base.ViewDidLoad(); this.source = new GroupedListSource(); this.source.TableView = this.TableView; // Register the TableView's data source this.TableView.Source = this.source; var groups = new List<IGroup>(); var section1 = new GroupViewModel(); section1.Header = new CaptionViewModel("Samples"); groups.Add(section1); section1.Rows.Add(new StringElementViewModel("Toast") { TapCommand = new DelegateCommand(() => { var md = new AlertMessageDisplay(); md.DisplayToast("toasted\nHello", true); }) }); section1.Rows.Add(new StringElementViewModel("Message") { TapCommand = new DelegateCommand(() => { var md = new AlertMessageDisplay(); md.DisplayMessage("title", "message", Actions.Null); }) }); this.source.Bind(groups); }
public static IList<IGroup> GetViewModel(SimpleViewModel theViewModel) { var groups = new ObservableCollection<IGroup>(); var group1 = new GroupViewModel(); group1.Header = new CaptionViewModel("Header 1"); groups.Add(group1); group1.Rows.Add(new StringWrapperElementViewModel(theViewModel, "Property1")); group1.Rows.Add(new StringWrapperElementViewModel(theViewModel, "Property2")); group1.Rows.Add(new StringElementViewModel("tap me") { TapCommand = new DelegateCommand(() => { ((StringWrapperElementViewModel)group1.Rows[0]).Value = "i was clicked"; }) }); return groups; }