Bind command from Business object to View in MVVM

后端 未结 1 1013
离开以前
离开以前 2020-12-20 06:05

I populate DataGrid in WPF through MVVM. I have business object with 4 properties to create the Row and Columns in the DataGrid.



        
1条回答
  •  臣服心动
    2020-12-20 07:01

    First of all, do not place your command into your Model, instead use binding through RelativeSource. Like this:

    Second, you can bind your DataGrid SelectedItem to property of you ViewModel

    
    

    or pass your selected item through CommandParameter.

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