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
175
Setting multiselect source
posted

I've experienced a weird issue lately.

 I have a wingrid with several columns, one of which is a checkbox column. If a user clicks a checkbox (which not only toggles the checkbox but also makes the row selected & active) and then shift clicks a row immediately afterwards it will select all rows from the top row all the way down to the row the user shift clicked, not the one the user originally clicked the checkbox from.

It doesn't seem to matter whether the row is set as selected active or selected, there seems to be some other property that indicates which row is the source row for a shift multi select.

 How would I go about manually setting a row as the the source row for a multiselect?

Parents
No Data
Reply
  • 469350
    Verified Answer
    Offline posted
    Hi,

        My guess is that the row you are clicking on is not selected, only active. It appears the same as a selected row by default, because the grid has a default ActiveRowAppearance and ActiveCellAppearance which makes it so. If you want to turn this off, you can go into the property grid at desing-time and go to grid.DisplayLayout.Override and right click on ActiveRowAppearance and ActiveCellAppearance and select Reset on each. 

       

    pkarski said:
     How would I go about manually setting a row as the the source row for a multiselect?
     

        This row is called the pivot row or pivot item. What is probably happening in your case is that you click on a cell and it becomes active, but not selected. So when you shift+click, there is no pivot row or maybe the pivot row starts out as the first row in the grid, so that's where the selection begins since you have never actually selected a row. 

        The pivot item is controlled by the ISelectionManager interface. So what you would do to set it is cast the grid into an ISelectionManager object and then call the SetPivotItem method and pass in the row you want. 

Children
No Data