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
955
Is there a "automatic" way to set/reset selected records when programatically changing an active record?
posted

I have a grid with IsSynchronizedWithCurrentItem set to true and is bind to an ICollectionView. I have SelectionTypeRecord="Single" so only one record can be selected at a time.

 I am programatically moving the CurrentItem of this view. While ActiveRecord is reset accordingly, issue is that XamDataGrid.SelectedItems.Records is not. SelectedItems not changed when changing ActiveRecord.

So to clear an active record I would have to do two steps:

                     _viewModel.DataKeysView.MoveCurrentTo(null);
                    dataKeysGrid.SelectedItems.Records.Clear();

 And to select record (for example):

                        _viewModel.DataKeysView.MoveCurrentToLast();
                        dataKeysGrid.Records[count - 1].IsSelected = true;

Is there any better way of doing this? Is there a way to @automatically@ synchronize selected item when changing an active record.

Thanks in advance.

Parents
  • 69686
    posted

    Hello,

    Settings by IsSynchronizedWithCurrentItem property of the XamDataGrid will synchronize the ActiveRecord of the XamDataGrid with the CurrentItem of the ICollectionView. This is by design.

    Please note that the active record does not mean that it is selected. A record can be selected by clicking on the records selector, holding the shift/ctrl key or by clicking on a cell (when the CellClickAction is set to Select Record). 

    If you want to select the active record, you can handle the RecordActivated event and select the record that has been activated.

Reply Children
No Data