I'm using the DevExpress XPF GridControl's NewItemRow for adding new row to my database. How to get the user entered data from new row. Am using prism framework. Here is my xaml
<dxg:GridControl.View>
<dxg:TableView AutoWidth="True" AllowEditing="True" NewItemRowPosition="Top">
<dxmvvm:Interaction.Behaviors>
<dxmvvm:EventToCommand EventName="RowUpdated"
Command="{Binding RowUpdateClickCommand}" CommandParameter="{Binding CurrentItem}"/>
</dxmvvm:Interaction.Behaviors>
</dxg:TableView>
</dxg:GridControl.View>
To get information about the updated row, you can pass EventArgs to your command. To accomplish this task, set the EventToCommand.PassEventArgsToCommand property to true:
<dxmvvm:EventToCommand EventName="RowUpdated" PassEventArgsToCommand="True"
Command="{Binding RowUpdateClickCommand}"/>
To determine that a user modified NewItemRow, you can compare RowEventArgs.RowHandle with the static GridControl.NewItemRowHandle property:
public class MyViewModel {
public MyViewModel() {
RowUpdateClickCommand = new DelegateCommand<RowEventArgs>(RowUpdateClick);
}
public ICommand RowUpdateClickCommand {
get;
set;
}
public void RowUpdateClick(RowEventArgs e) {
if (e.RowHandle == GridControl.NewItemRowHandle) {
//e.Row - new row is here
}
}
}
Please note that if you don't wish to pass event args to the view model level, you can convert them using EventArgsConverter