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
25
Multi selection of cells, but only in same column
posted

Hi,

I'm working with the UltraGrid and want to control how cells are selected.
My issue is that I want to allow multi selection of cells, but only if the cells are placed in the same column.

I have tried extending the UltraGrid, and overridden the IsItemSelectableWithCurrentSelection method. And on top of that I have implemented my own own "ColumnSelectionStrategy", which inherits SelectionStrategyContiguous. In that class I have overridden the CanItemBeNavigateTo method.

The code seems to be working, if I use the keyboard to select cells with. But if I use the mouse instead, the grid still allows selection of cells across columns.

Am I even going in the right direction with this?

Parents
No Data
Reply
  • 469350
    Verified Answer
    Offline posted

    I think the easiest thing to do would be to handle the BeforeSelectChange event and check the new selection. If there are cells selected from more than one column, cancel the event. 

Children
No Data