I've decided to dabble a bit in MonoDroid and MonoTouch and port one of my WP7 apps as a starter. I would really like to reuse my existing ViewModels but since both Android and iOS seem to have no such thing as XAML's strong databinding I would like to ask if anyone went that route before and can recommend some best practices or existing solutions.
相关问题
- Custom controls disabled. There was an internal is
- Error:Xamarin.Forms targets have been imported mul
- ObservableCollection in ViewModel is not updated w
- Monodevelop: `Waiting for debugger`
- System.IO.MemoryMappedFiles on MonoTouch?
相关文章
- Visual Studio Code, MAC OS X, OmniSharp server is
- Bundling the Windows Mono runtime with an applicat
- Xamarin form MessagingCenter Unsubscribe is not wo
- Best way to implement MVVM bindings (View <-> V
- The type initializer for 'SQLite.SQLiteConnect
- How to use native C++ libraries in Mono for Androi
- Xamarin build error: defining a default interface
- Xamarin Android Player Error when attempting to fi
We're doing this with an application right now, but writing for iOS first (even before Windows). It is not full of rainbows and ponies for sure.
I would recommend the following:
#if iPhone
directive. INotifyPropertyChanged or ICommand are examples.#if iPhone
and#if Android
statements possible.I know you are working with an existing application, so it's tough. It may be simpler to just reuse your business model and that's it. Android and iOS have MVC patterns of their own, and are drastically different from WPF. You might also only need a subset of each ViewModel on mobile devices, which could make it easier to just rewrite.
In our case:
I've recently finished a large project which we wrote wp7 first, and which was then ported into touch and droid.
As part of this we've released our own mvvm framework - including some databinding support for touch and droid - the source is available at http://github.com/slodge/mvvmcross
The experience of porting to droid was good - the axml layout files provided a good hook for databinding. Currently, however, i'm not quite as happy with the binding we achieved for touch - although montouch.dialog does at least provide us with some nice looking code sometimes.