Home Forums WinForms controls Xceed Grid for WinForms Preventing Multiple selectedrowschanged events Reply To: Preventing Multiple selectedrowschanged events

Xceed Support
Member
Post count: 5658

The SelectedRowsChanged will be triggered each time you add a row to the SelectedRows. You could use the CurrentRowChanged event that will only be triggered when the CurrentRow will be changed (in the case of multi-selection, the CurrentRowChanged will only be triggered once). However, it will be triggered before the rows are selected, it may not be as useful.

The best way to manage this is to put an “if” statement in the SelectedRowsChanged event to only run once each time there is a selection.

<code>
void gridControl1_SelectedRowsChanged( object sender, EventArgs e )
{
if(isTheFirstTimeSelectedRowsChangedIsTriggered)
{
//Do the action
}
}
</code>

Imported from legacy forums. Posted by CharlesB (had 3075 views)