Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
710
How to have only one line selected using BindingSource.MoveNext/Previous?
posted

I'm having problems with UltraGrid again.

Let's say we have a form with an UltraGrid on it. The grid is databound to a generic BindingList. User is by design not able to edit/add/delete. User can select only one row at time (no multiselect).

The grid is accompanied by "Move Next" and "Move Previous" buttons.. I want to be able to change the currently selected row.

I thought I could acheive this using BindingSource.MoveNext and MovePrevious methods. Partially. The selection changes indeed. Unfortunately, the previously selected item (using either mouse click or keyboard) stays selected (visually).

Similar behaviour can be observed when a user clicks a row, holds the LMB, and moves the cursor over any other row. When the LMB is released UltraGrid shows that 2 rows are selected, instead of only one.

WindowsFormsApplication1.zip
Parents
No Data
Reply
  • 48586
    posted

    Hello ,

     

    Thank you for the provided sample. I have had tests it with Infragistics 11.2 service release 2050 (which is the latest available service release ), and I have noticed that there is two selected cell at time, when you click with mouse and then click on button1, but it is because you have set CellClickAction to CellSelect. If you what to keep the value of this property and to avoid this behavior you should clear selected cells collection (ultraGrid1.Selected.Cells.Clear();) before calling MoveNext()

     

     

     

    Please let me know if you have any further questions.

Children