Hi,
this is the default behavior of the
DataGrid
, you can select and unselect a row in a
DataGrid
.
To prevent this, listen to the
DataGrid.SelectionChanged
event.
In the event handler you could type e.g.:
private void SelectionChanged(object sender, SelectionChangedEventArgs e)
{
DataGrid g = sender as DataGrid;
if (g != null && e.AddedItems.Count == 0 && e.RemovedItems.Count > 0)
{
g.SelectedItem = e.RemovedItems[0];
}
}
This should prevent the deselection of the row.
Hope this helps.
Regards,
Thomas.