Is it me or doesn't the SelectedItemsChanged event fire when a new DataSource has been set?(when there where items selected before the datasource changed)
Hello,
This is expected behavior. SelectedItemChanged is when the selected item has been changed from user interaction. You can, however, request a feature for an event that fires at DataSource change/update.
Alex.
Hi Alex,
I don't really agree because if the event should only listen to user interaction why does it fire twice when I do:
dataGrid.Records[0].IsSelected = true;
dataGrid.Records[0].IsSelected = false;
I think it would make more sense that the event is fired whenever an item is selected or deselected through user interaction or code behind (when all the records have been removed or the datasource changed).
Example: (Event should fire 2 times):
// No items are selected
dataGrid.DataSource = dataSource1;
// Select an item (Event fire 1)
// The selected item is removed and thus unselected
// so the event should fire (Event fire 2)
dataGrid.DataSource = dataSource2;