This example illustartates how to pause data updates when a user edits a row in the Edit Form. To do that, handle the RowEditStarted and RowEditFinished events. Alternatively, you can create commands in a View Model and bind them to the RowEditStartedCommand and RowEditFinishedCommand properties.
In this example, the GridControl updates data on a timer. The UpdateRows()
function updates data depending on the updatesLocker
value. When a user starts to edit a row, the RowEditStarted event occurs. The event handler sets the updatesLocker
value to true to lock data updates. When the user finished editing the row, RowEditFinished occurs and the event handler unlocks updates.
bool updatesLocker;
// ...
private void OnRowEditStarted(object sender, RowEditStartedEventArgs e) => Volatile.Write(ref updatesLocker, true);
private void OnRowEditFinished(object sender, RowEditFinishedEventArgs e) => Volatile.Write(ref updatesLocker, false);
void UpdateRows(object parameter) {
if(!Volatile.Read(ref updatesLocker)) {
var row = data[random.Next(0, data.Count)];
if(row.ShouldUpdate) {
row.Value = random.Next(1, 100);
}
}
}
In the TreeListView, use the following events and properties:
- Edit Form
- RowEditStarted / NodeEditStarted
- RowEditFinished / NodeEditFinished
- RowEditStartedCommand / NodeEditStartedCommand
- RowEditFinishedCommand / NodeEditFinishedCommand
- Data Grid for WPF - How to Process Related Cells in the Edit Form
- Data Grid for WPF - How to Specify Edit Form Settings
(you will be redirected to DevExpress.com to submit your response)