I have used the above code, and it works great for a single select datagrid.
However, I have a case where the datagrid selection mode is set to SelectionMode.Extended. I changed the code what is shown below, and I do not get any notification when the 2nd, 3rd, etc... item is selected.
In other words, I select one item, and the event fires. If I hold down the shift key to select the next item in the list also, the event does not fire, even though the SelectedItems count is now 2, instead of 1.
Is this a bug, or is there some other way I can get notified when an additional item is selected?
---------------------------------------------------------------------------------------------
DependencyPropertyDescriptor SelectedItemsChangedDescriptor =
DependencyPropertyDescriptor.FromProperty(DataGridControl.SelectedItemsProperty,
typeof(DataGridControl));
SelectedItemsChangedDescriptor.AddValueChanged(myGrid,
new EventHandler(OnSelectedItemsChanged));
private void OnSelectedItemsChanged(object sender, EventArgs e)
{
// Do something with this event
}
------------------------------------------------------------------------------------------------------