private void CreateLayout() { var ProfileBorder = AutoLayoutContentView.CreateListContentRoot("ListContentRoot", UIColor.LightGray, ContentView, "Helvetica-Bold"); var Details = ProfileBorder.AddContainer("Details", UIColor.White); var Photo = ProfileBorder.AddContainer("Photo", UIColor.White); ProfileBorder.AddConstraint("V:|-[Details(>=30)]-|"); ProfileBorder.AddConstraint("V:|-(>=2)-[Photo]-(>=2)-|"); ProfileBorder.AddConstraint("H:|-[Details]-(>=8)-[Photo]-26-|"); Photo.AddImage("Picture", "Alex.jpg"); Photo.AddConstraint("H:|[Picture(24)]|"); Photo.AddConstraint("V:|[Picture(32)]|"); var name = Details.AddLabelLeft("Name", "Alex Eadie", UIColor.Black, 10); var phone = Details.AddLabelLeft("Phone", "0456 234 154", UIColor.Blue, 10); Details.AddConstraint("V:|-(>=2)-[Name]-(>=2)-[Phone]-(>=2)-|"); ContentView.AddSubviews(ProfileBorder); this.DelayBind(() => { var set = this.CreateBindingSet <ListExampleTableRow, ContactDetail> (); set.Bind(phone).To(vm => vm.PhoneNumber); set.Bind(name).To(vm => vm.Name); set.Apply(); }); }
public override void ViewDidLoad() { this.View = new UIView { BackgroundColor = UIColor.White }; base.ViewDidLoad(); var Set = this.CreateBindingSet <ListExampleView, ListExampleViewModel> (); var Root = AutoLayoutContentView.CreateRoot("Root", UIColor.DarkGray, "Helvetica-Bold"); var ListPanel = Root.AddContainer("ListPanel", UIColor.White); var OuterLabel = Root.AddLabel("OuterLabel", "The Beautiful App", UIColor.White, 12); Root.AddConstraint("V:|-24-[OuterLabel]-[ListPanel]-|"); Root.AddConstraint("H:|-[OuterLabel]"); Root.AddConstraint("H:|-4-[ListPanel]-4-|"); var InnerLabel = ListPanel.AddLabel("InnerLabel", "Contacts List", UIColor.Black, 12); var DataTable = ListPanel.AddTableView("DataTable"); ListPanel.AddConstraint("H:|-[InnerLabel]-(>=8)-|"); ListPanel.AddConstraint("V:|-16-[InnerLabel]-[DataTable]-|"); ListPanel.AddConstraint("H:|-[DataTable]-|"); var listExampleTableSource = new ListExampleTableViewSource(ViewModel, DataTable); var refreshControl = new MvxUIRefreshControl(); DataTable.AddSubview(refreshControl); DataTable.Source = listExampleTableSource; DataTable.ReloadData(); View = Root; Set.Bind(listExampleTableSource).To(vm => vm.Contacts); Set.Bind(refreshControl).For(r => r.RefreshCommand).To(vm => vm.ReloadCommand); Set.Bind(refreshControl).For(r => r.IsRefreshing).To(vm => vm.IsBusy); Set.Apply(); }