SelectAll event

Would it be possible to have dataGrid.SelectAll() throw a SelectionChanged event when it's complete? Or is there some reason why it doesn't do that? I've noticed that neither it nor SelectRows() will trigger a SelectionChanged.

I realize that dataGrid.ClearSelections(false) also doesn't trigger an event so it may be on purpose. But at least with clearing selection I can use SelectedItems.Clear() and it will send exactly one SelectionChanged event.

If I use SelectedItems.Add() for each thing I want selected I'll end up with an event for every item. And I do see there's a SelectionController.SelectedRows.AddRange() that maybe will trigger a single event but I can't figure out how to get the GridRowInfo objects that it needs. Is there an easy way to get the first and last GridRowInfo for the dataGrid View? Hopefully my question makes sense. I can work around this but thought it odd that my SelectionChanged listener wasn't doing anything every time i used SelectAll().


3 Replies 1 reply marked as answer

SJ Sathiyathanam Jeyakumar Syncfusion Team July 4, 2022 03:25 PM UTC

Hi John,


We have analyzed your query and the SfDataGrid.SelectionChanged event will be triggered only to the keyboard and mouse interactions. When the programmatic Selection applied to the DataGrid then the  SfDataGrid.SelectionChanged event does not trigger. We have mentioned this in Our SelectionChanged event API reference. Please refer the API reference link from below,


https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.Grid.SfDataGrid.html#Syncfusion_UI_Xaml_Grid_SfDataGrid_SelectionChanged


Regards

Sathiyathanam


Marked as answer

JO John July 4, 2022 06:57 PM UTC

Ok that makes sense.



DM Dhanasekar Mohanraj Syncfusion Team July 5, 2022 03:17 PM UTC

Hi John,

If you are satisfied with our response, please mark it as an answer. Otherwise, please let us know if you have any further queries on this. We are happy to help you.

Regards,
Dhanasekar M.


Loader.
Up arrow icon