Cannot bind command within a ListBox

前端 未结 1 1750
孤独总比滥情好
孤独总比滥情好 2021-01-28 12:22

My WPF uses the MVVM approach. I\'m trying to bind 2 controls within my list control



        
1条回答
  •  栀梦
    栀梦 (楼主)
    2021-01-28 13:17

    The ancestor search finds the control, not the DataContext, so you'll need to tell your binding where to find the DeleteCommand property. If your ViewModel is the DataContext of the MainWindow then you can just use:

    0 讨论(0)
提交回复
热议问题