Using the parent's DataContext (WPF - Dynamic Menu Command Binding)

后端 未结 4 747
一个人的身影
一个人的身影 2020-12-25 12:50

I looked over this web and google and the solutions didn\'t work for me.

I have a command on the ViewModel of a UserControl. Well, The usercontrol have a ItemsContro

4条回答
  •  有刺的猬
    2020-12-25 12:58

    If you want a dirty, MVVM-breaking solution, then set the Tag="{Binding}" on the button and handle the Click event. In the event handler, call the command on your ViewModel.

提交回复
热议问题