数据绑定操作顺序为卡利微Xamarin [英] Data Binding Order of Operations for Caliburn Micro Xamarin
问题描述
什么是操作顺序(OOP)进行数据的Caliburn.Micro Xamarin的Android(Mono.Android)绑定
What is the "Order of Operations" (OOP) for Data Binding in Caliburn.Micro Xamarin Android (Mono.Android)?
PS:教程解释/比较如何绑定在卡利微型标准/ WPF,卡利微Android和放大器发生;卡利微的iOS(即Caliburn.Micro Xamarin)将是非常有益和一个不错的引入卡利微Xamarin。
PS: a tutorial that explains/compares how binding occurs in Caliburn Micro Standard/WPF, Caliburn Micro Android & Caliburn Micro iOS (ie Caliburn.Micro Xamarin) would be very useful and a nice introduction into Caliburn Micro Xamarin.
有关定期Caliburn.Micro用于绑定的OOP是(正确我,如果我错了):
For regular Caliburn.Micro the OOP for Binding is (correct me if I am wrong):
- 在视图模型声明字段
- 在现场设置:来电
NotifyOfPropertyChange(..)
- 查看绑定使用XAML属性视图模型
X:名称
- Declare Field in ViewModel
- On Field Set: call
NotifyOfPropertyChange(..)
- Bind View to ViewModel using the XAML attribute
x:Name
我已经检查了示例项目 Hello.Xamarin
和 HubBrowser
,我想我有一点想法它是如何工作的,但它看起来像有需要设置的很多东西。对于Caliburn.Micro Xamarin Android是绑定OOP像...?
I've inspected the example projects Hello.Xamarin
and HubBrowser
and I think I have a bit of an idea how it works but it looks like there is ALOT of setup required. For Caliburn.Micro Xamarin Android is the Binding OOP something like...?
- 延长
NotifyPropertyChanged
方法。不知道为什么...也许所以它适用于Android的?我们产生一种叫静态类NotifyPropertyChangedExtensions
- 在视图模型(标准CM一样)
- 在现场设置:呼叫
NotifyOfPropertyChange(..)
(同标准CM) - 给所有View部件一个唯一的ID
的android:ID
- 在查看(活动)创建:绑定查看小部件视图模型字段不知何故?
声明字段
- Extend the
NotifyPropertyChanged
method. Not sure why...maybe so it works for Android? We produce a static class calledNotifyPropertyChangedExtensions
- Declare Field in ViewModel (same as standard CM)
- On Field Set: call
NotifyOfPropertyChange(..)
(same as standard CM) - Give all View widgets a unique id
android:id
- On View (Activity) creation: bind View widgets to ViewModel Fields somehow??
推荐答案
从本质上讲,你已经表明了结合Windows的味道OOP引擎盖下发生,该系统是第一个视图模型都意味着一个视图模型开始从那里,我们看看,如果我们有相同的命名空间和名称的视图。如果我们找到了,太好了,现在再加上一个绑定操作基本设置与视图模型实例的视图的DataContext的混搭他们。否则,无法得到最终的画面默认两眼发直回你:(。
Essentially the OOP you have indicated for the Windows flavor of binding occurs under the hood, the system is ViewModel first meaning everything starts with a viewmodel from there we look to see if we have a View with the same namespace and name. If we find it, great, now mash them together with a binding operation essentially setting the Datacontext of the view with the instance of the viewmodel. Otherwise, fail give the resultant screen a default blank stare back at you :(.
由于与Xamarin /本地绑定关联的东西稍有不同,因此一些功能可能会来在以后的日子有更多的教程/样本,因为人们有机会路试的代码。
Since the stuff associated with binding in Xamarin / Native is slightly different hence some of the features will probably come at a later date with more tutorials / samples as people get a chance to road test the code.
链接有一些东西还没有完成,东西,配有解释,为什么或者为什么不
的https:// github.com/Caliburn-Micro/Caliburn.Micro/issues/142
Link has some of the stuff yet to complete and stuff that is complete with explanations as to why or why not. https://github.com/Caliburn-Micro/Caliburn.Micro/issues/142
这篇关于数据绑定操作顺序为卡利微Xamarin的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!