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.