Home Forums WinForms controls Xceed Grid for WinForms GridControl SelectedRowsChanged Reply To: GridControl SelectedRowsChanged

User (Old forums)
Member
Post count: 23064

You have basically two choices.

First, permit the user to select only one row (GridControl.SelectionMode = SelectionMode.One), which is probably not what you are looking for.

The other suggestion is to use the Application.Idle event, and update the menu in that event according to the rows selected at that moment.

i.e.:

private bool m_selectionChanging;

void gridControl1_SelectedRowsChanged( object sender, EventArgs e )
{
System.Diagnostics.Debug.WriteLine( “SelectedRowsChanged” );
//first time in SelectedRowsChanged
if( !m_selectionChanging )
{
m_selectionChanging = true;
Application.Idle += new EventHandler( Application_Idle );
}

}

//triggered after the user is done selecting rows
void Application_Idle( object sender, EventArgs e )
{
Application.Idle -= new EventHandler( Application_Idle );
m_selectionChanging = false;

System.Diagnostics.Debug.WriteLine( “DONE” );
//you would update menu here, using gridControl1.SelectedRows
}

Imported from legacy forums. Posted by André (had 595 views)