Пример #1
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            TableView.BackgroundColor = UIColor.White;

            NavigationController.NavigationBar.Hidden       = false;
            NavigationController.NavigationBar.BarStyle     = UIBarStyle.Black;
            NavigationController.NavigationBar.BarTintColor = Colors.Primary;
            NavigationController.NavigationBar.Translucent  = false;
            NavigationController.NavigationBar.Opaque       = true;
            NavigationController.NavigationBar.TintColor    = UIColor.White;

            NavigationItem.BackBarButtonItem = null;


            TableView.RegisterClassForCellReuse(typeof(ContactItemCell), ContactItemCell.Key);
            _source          = new ContactsTableViewSource(TableView, ContactItemCell.Key);
            TableView.Source = _source;

            var set = this.CreateBindingSet <ContactsViewController, ContactsViewModel>();

            set.Bind(_source).To(vm => vm.Contacts);
            set.Bind(_source).For(s => s.SelectionChangedCommand).To(vm => vm.ContactClickCommand);
            set.Bind().For(v => v.Title).To(vm => vm.Title);
            set.Apply();
        }
Пример #2
0
        protected override void Binding()
        {
            base.Binding();

            _refresh = new MvxUIRefreshControl();

            var emptyDataSet = new EmptyDataSet(ContentView, ViewModel.RefreshCommand);
            var source       = new ContactsTableViewSource(TableView, ContactTableViewCell.Key, ContactTableViewCell.Key);

            var set = this.CreateBindingSet <ContactsView, ContactsViewModel>();

            set.Bind(emptyDataSet).For(StatesTargetBinding.Key).To(vm => vm.State);
            set.Bind(source).To(vm => vm.Items);
            set.Bind(source).For(s => s.GetContactsCommand).To(vm => vm.LoadNextPage);
            set.Bind(source).For(v => v.SelectionChangedCommand).To(vm => vm.ItemClickCommand);
            set.Bind(_refresh).For(r => r.IsRefreshing).To(vm => vm.IsRefreshing);
            set.Bind(_refresh).For(r => r.RefreshCommand).To(vm => vm.RefreshCommand);
            set.Apply();

            TableView.Source         = source;
            TableView.RefreshControl = _refresh;
            TableView.ReloadData();
        }