Calling a Method of a UserControl in MVVM

前端 未结 7 453
温柔的废话
温柔的废话 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:19

    Maybe your UserControl should really be a View, which then should have a ViewModel, which would contain the DoStuff() method. SomeViewModel will have instantiated (are at leased casused to be instantiated) SomeControlViewModel, and so be able to call a method on it.

提交回复
热议问题