Use Mvvmcross Binding with MonoTouch.Dialog (Lists and Commands)

自作多情 提交于 2019-12-01 01:00:49

1. Binding lists

An example of binding dynamic ObservableCollection lists is in https://github.com/slodge/MvvmCross-Tutorials/blob/master/DialogExamples/DialogExamples.Touch/Views/ThirdView.cs - it uses some custom elements from https://github.com/slodge/MvvmCross-Tutorials/tree/master/DialogExamples/DialogExamples.Touch/BindableElements - which was based on the sample from https://github.com/asednev/MvvmCross.AlexeysExtensions

Because of the way Radio lists are internally implemented, I don't know if the same ObservableCollection binding approach would work for radio lists - someone would need to prototype and experiment to work this out. However, a simple fixed radio list is shown in https://github.com/slodge/MvvmCross-Tutorials/blob/master/DialogExamples/DialogExamples.Touch/Views/FirstView.cs

2. CommandBinding

See an example in: https://github.com/slodge/MvvmCross-Tutorials/blob/master/DialogExamples/DialogExamples.Touch/Views/FirstView.cs

                new Section("Action")
                    {
                        new StringElement("Second").Bind(bindings, element => element.SelectedCommand, vm => vm.GoSecondCommand),
                        new StringElement("Bindable Elements").Bind(bindings, element => element.SelectedCommand, vm => vm.BindableElementsCommand)  
                    },
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!