WPF MVVM Button Control Binding in DataTemplate

前端 未结 3 1740
难免孤独
难免孤独 2021-01-14 09:34

I\'ve seen other questions that deal with this, but never any explicit code describing the fix. I can\'t get a button inside of my ItemTemplate to bind to ANY command anywhe

3条回答
  •  粉色の甜心
    2021-01-14 09:58

    The button in the datatemplate should bind to command PauseCommand since it's datacontext is PrinterViewModel and not MainWindowViewModel. If you look in the debug output VS will clearly tell you that.

提交回复
热议问题