Am i following correct MVVM in this scenario?

Balaji_VBalaji_V Member ✭✭

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. ??

Tagged:

Answers

  • JohnHJohnH GBMember ✭✭✭✭✭

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

  • CharwakaCharwaka INMember ✭✭✭✭✭

    @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

Sign In or Register to comment.