Home Forums WPF controls Xceed DataGrid for WPF Issue with shift key and multiselecting rows

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

    We have a datagridcontrol where I need to maintain an array of the selected items – so if the selected item changes I have to add the item to this array.

    To catch this event I have my code that looks like this:

    DependencyPropertyDescriptor SelectedItemChangedDescriptor =

    DependencyPropertyDescriptor.FromProperty(DataGridControl.SelectedItemProperty, typeof(DataGridControl));

    SelectedItemChangedDescriptor.AddValueChanged(element, new EventHandler(OnSelectedItemChanged));

    So every time the selected row is changed, I can maintain my array of selected items since the OnSelectedItemChanged event fires and I maintain the selected rows array in the code for this handler. But in case of multiselect, if I hold down the shift key and select multiple rows, this event does not fire – it only fires if I hold down the control key while selecting multiple rows.

    I tried the SelectedItemsProperty and the SelectedIndexProperty and the behaviour is the same.

    Imported from legacy forums. Posted by Ranjana (had 497 views)

    User (Old forums)
    Member
    Post count: 23064

    You can use the PropertyChanged event and look for the CurrentItem property and build you array of selected Items.

    It works for both CTRL & SHIFT Keys.

    Imported from legacy forums. Posted by Karthik (had 2658 views)

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