Home Forums WinForms controls Xceed Grid for WinForms Preventing Multiple selectedrowschanged events

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #15635 |

    Hi,

    I’m having a problem with the SelectedRowsChanged event Xceed Grid. When I do a multi select of 10 rows at a time using ‘Shift’ key and mouse click, the ‘SelectedRowsChanged’ event is getting raised 10 times. This is effecting the UI performance

    Please let me know how to prevent multiple events.

    -Thanks

    Imported from legacy forums. Posted by Vara (had 1819 views)

    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)

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.