Calling a Method of a UserControl in MVVM

前端 未结 7 565
温柔的废话
温柔的废话 2021-01-17 14:26

I\'m having an issue with calling a method on a UserControl. Hear me out:

  1. I have a UserControl someControl in SomeView.xaml

  2. Som

7条回答
  •  春和景丽
    2021-01-17 15:16

    If the method DoStuff(); does some UI specific logic then the method is in the right place. When not then it should be in another object (e.g. SomeViewModel).

    SomeViewModel is allowed to call a method on SomeView when it is separated via an interface. How this can be accomplished is shown by the WPF Application Framework (WAF).

提交回复
热议问题