开发者

Is there any data binding support for MonoTouch?

开发者 https://www.devze.com 2023-01-17 17:34 出处:网络
I am thinking about how an application can be written to work on both Windows 7 Phone and IPhone, one option is to use MonoTouch and structure the app with MVVM, then only the views will need to be di

I am thinking about how an application can be written to work on both Windows 7 Phone and IPhone, one option is to use MonoTouch and structure the app with MVVM, then only the views will need to be different between the platforms.

However MonoTouch does not seem to support data binding.


When (if) data binding support is added to MonoTouch, please provide an answer to this quesions and I will change the excepted answer.

see also Is there any data binding mechan开发者_JAVA百科ism available for iOS?


Straight out of the box, though, MonoTouch doesn't support databinding. It follows the Apple MVC framework for apps, which doesn't have binding at all. There is a project on github that simplifies a lot creating data tables, though: http://github.com/migueldeicaza/MonoTouch.Dialog.

There has been talks recently about porting some of the silverlight code (from moonlight) to MonoTouch, now that Apple opened the floodgates on what can be done with iOS apps. The Novell guys haven't released anything yet, but my guess is that somebody is probably looking into it right now.


There is an open source framework that started with MonoTouch.Dialog and added DataBinding. It has taken on a life of its own and the goal now is to be a common framework for iOS, Android, and WP7. Although it is still in beta for iOS only at this point.

https://github.com/RobertKozak/MonoMobile.MVVM


MVVMCross has to be the way to go, it is currently in V3 beta and is very robust.

https://github.com/slodge/MvvmCross


See comment and also updated answer from @Blounty

Probably not the databinding answer you were after... but the MonoCross framework has now hit version 1.0

This framework provides an MVC base for WP7, Droid and Touch.

I've just (in the last week) started adding our own binding support inside Droid and Touch - for our app, it's easy enough to bind to the INotifyPropertyChanged event and to make your own UI adjustments.

More info on http://code.google.com/p/monocross


A possible alternative is this: https://github.com/aka-ios-beacon

This is a native (Objective-C) framework that integrates into interface builder (but does not require it). Bindings are typically defined in IBInspecatable extension properties of views and view controllers, which means that they can be edited in StoryBoards.

By default, view controllers serve as root view model for bindings (found in the controllers view hierarchy). Bindings and observation is implemented using Key-Value coding, so the only requirement for view models is that properties used in binding expressions are key value coding-compliant.

I don't know if Xamarin supports IBdesignable properties or if it's possible to edit Xamarin storyboards with Xcode/IB. (Since I'm the author of AKABeacon, I would be very happy to integrate binding support into Xamarin if needed)

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号