locked
Am i following correct MVVM in this scenario? RRS feed

  • Question

  • User364386 posted

    Consider i have a ContentPage1 and its respective ViewModel ContentPage1ViewModel. In this ContentPAge1 i'm having a ContentView with Content ={Binding view}. This View i am dynamically changing from ContentPage1ViewModel.

    In this case , TheContentPage1ViewModel knows about ContentView view in which the view property wil get changed.

    Is this correct with respect to MVVM pattern. ??

    Thursday, October 10, 2019 12:40 PM

All replies

  • User74 posted

    The ViewModel should not know anything about your view, it should expose properties that the view binds to.

    Thursday, October 10, 2019 5:50 PM
  • User155041 posted

    @Balaji_V said: Consider i have a ContentPage1 and its respective ViewModel ContentPage1ViewModel. In this ContentPAge1 i'm having a ContentView with Content ={Binding view}. This View i am dynamically changing from ContentPage1ViewModel.

    In this case , TheContentPage1ViewModel knows about ContentView view in which the view property wil get changed.

    Is this correct with respect to MVVM pattern. ??

    Just follow this

    https://docs.microsoft.com/en-us/xamarin/xamarin-forms/enterprise-application-patterns/mvvm

    Thursday, October 10, 2019 8:56 PM