Forum Xamarin.Mac


The Xamarin Forums have officially moved to the new Microsoft Q&A experience. Microsoft Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

To create new threads and ask questions head over to Microsoft Q&A for .NET and get involved today.

Can MVVM be applied via VS for Mac?

blagovestblagovest Member ✭✭

Hi Team,

I am developing a WPF app under the MVVM pattern which I want to migrate to Mac as well. Due to the MVC pattern a have the impression (still didn't make a testing) that my ViewModels will not be able to fit very well with the ViewControllers in MVC. As you can imagine I want less rewriting code thus MVVM would fit best. Is there any way to replace the View Controllers with ViewModels and respective data binding?



  • TedRogersTedRogers USMember ✭✭✭✭

    I think most people use a framework like MVVM-Lite or Xamarin.Forms to accomplish what you are looking for. Both support data binding. If you don't want to use either of those frameworks, it is pretty trivial to setup "OneWay" data binding by setting up a view model "PropertyChanged" handler in your view controller. Since most binding is typically "OneWay" this takes care of a lot of cases. Pushing changes back to your view model is a little more work without a framework that supports data binding.

  • IvanIcinIvanIcin USMember ✭✭✭

    You can reuse large portions of your business logic fairly easy. Binding is going to take some work in any way and personally I handle it myself as @TedRogers mentioned. Xamarin.Forms are too limited for macOS to be considered as the primary solution, and MVVM plugins tend to be buggy and as far as I have seen their implementations they result in a code that's hard to maintain and implementing them takes quite a time which makes do it your self option quite tempting.

Sign In or Register to comment.