在DataGrid中实现Button Command

时间:2021-07-02 17:59:17
Command="{Binding butCommand}"会默认查找ListViewItems中对象的属性,而你的ListViewItems中对象应该不包括butCommand属性;
可以尝试:
Command="{Binding DataContext.butCommand,RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Windows}}}"(假设最外层窗体为Windows)