Пример #1
0
        public override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            this.viewModel = new SimpleViewModel();

            // we can either put this here or in will appear (onResume), depending on what we need to do with loading for the VM.
            this.loader = new ViewModelLoader<string>(this.GetHelloWorld, this.UpdateViewModel, new UIThreadScheduler());
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            this.viewModel = new SimpleViewModel();

            // we can either put this here or in will appear, depending on what we need to do with loading for the VM.
            this.loader = new ViewModelLoader<string>(this.GetHelloWorld, this.UpdateViewModel, new UIThreadScheduler());

            // 
            this.NavigationItem.RightBarButtonItem = new UIBarButtonItem(UIBarButtonSystemItem.Play, (s, e) =>
            {
                    this.NavigationController.PushViewController(new SimpleListController(), true);
            });
        }
Пример #3
0
        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;
        }
Пример #4
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            var theViewModel = new SimpleViewModel();

            theViewModel.Property1 = "Hello";
            theViewModel.Property2 = "World";


            // view did load equivalent
            this.source = new GroupedListSource(this, DialogDataTemplates.DefaultTemplates(this));
            this.source.ListView = this.ListView;

            // Register the TableView's data source
            this.ListView.Adapter = this.source;

            this.source.Bind(WrappedSimpleViewModel.GetViewModel(theViewModel));

            // Create your application here
        }
Пример #5
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            this.source = new GroupedListSource(DialogDataTemplates.DefaultTemplates());
            this.source.TableView = this.TableView;

            var theViewModel = new SimpleViewModel();

            theViewModel.Property1 = "Hello";
            theViewModel.Property2 = "World";


            // Register the TableView's data source
            this.TableView.Source = this.source;

            this.source.Bind(WrappedSimpleViewModel.GetViewModel(theViewModel));
        }