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
975
XamDataGrid Extended Selection, ActiveItem and SelectedItems
posted

Hi,

I'm using XamDataGrid with MVVM,

I implemented a Context Menu as the below post

XamDataGrid ContextMenu Handler in MVVM

I also implemented a Dependency Property to bind SelectedItems in my ViewModel, where I subscribe to the event SelectedItemsChanged of the XamDataGrid to update the bind collection.

The problem, is that "drp.DataPresenter.ActiveRecord = drp.Record;" in RecordActivationAction doesn't trigger SelectedItemsChange, actually the active record is not mark as selected. The context menu items are bind to commands, those commands use selected items as source.

I can't just add the record to the selected items, because the user might press CTRL, SHIFT or nothing when they mouse click, changing which records will be in the selected items after.

Any suggestions,

Thanks,

Dominik

 

 

Parents
  • 27093
    posted

    Hello Dominik,

     

    I have been looking into your description and this is the expected behavior since the SelectedItems.Records Collection has any items only if there are selected records other form the ActiveRecord. In other words if only one record is selected, thus activated, there is no need for the Selecteditems.Records collection and since only the ActiveRecord can be used, only the RecrodActivating/Activated events are fired. I can suggest you handle them  in order to fill in the missing logic in your implementation.

     

    Please let me know if you require any further clarification on the matter. 

Reply Children
No Data