コード例 #1
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            var folderControl = new FolderControl();

            AddChildViewController(folderControl);
            FolderView.AddSubview(folderControl.View);

            var mailControl = new MailControl();

            AddChildViewController(mailControl);
            MailView.AddSubview(mailControl.View);

            var source = new MvxSimpleTableViewSource(FoldersTable, FolderCellTemplate.Key, FolderCellTemplate.Key);

            FoldersTable.Source = source;

            var set = this.CreateBindingSet <FoldersView, FoldersViewModel>();

            set.Bind(source).To(vm => vm.Folders);
            set.Bind(source).For(s => s.SelectedItem).To(vm => vm.SelectedFolder);
            set.Apply();

            this.Title = "MailApp";

            //As the folder is also showed on this view, we don't wait for the user to select one
            ((FoldersViewModel)ViewModel).SelectedFolder = ((FoldersViewModel)ViewModel).Folders.FirstOrDefault();
        }