locked
Xamarin Forms - Does using Messaging Center break MVVM pattern? RRS feed

  • Question

  • User366385 posted

    Hey so I understand the concept of Messaging Center and it's great for communicating with the view model. However, the view model must reference Xamarin.Forms namespace. Does this not break the concept of MVVM, by bringing Xamarin.Forms into the view models?

    Wednesday, August 21, 2019 4:33 PM

Answers

  • User76049 posted

    Message centre is generally used as a fudge in a lot of cases to get round design smells although it is useful when communicating between uncoupled components.

    Technically yes, it breaks the pattern. You could make an implementation behind. Prism uses EventAggregator which is nicer as it can be mocked.

    • Marked as answer by Anonymous Thursday, June 3, 2021 12:00 AM
    Wednesday, August 21, 2019 4:39 PM