We assign a xamDataGrid data source a binding list which implements ICollectionView, and set
xamdataGrid's IsSynchronizedWithCurrentItem = true, the currentItem can synchronize with the active
record in grid, but the currentPosition is not visual index synchronize with grid show. How can I get
visual index through collection view?
Thanks.
Hello,
Can you please give us more details on your scenario and what you are trying to achieve with the Visible index of a record? The ActiveRecord property is synchronized with the CurrentItem of the ICollectionView.
Hi,
I am doing a MoveUp/Down control that can be used to move one selected row in xamDataGrid position up or down, I want this control can be "control neutral", so it can also been used to wpf controls like ListBox, ItemsControl; So I want to do this operation in Collection View.
In wpf controls like ListBox, ItemsControls, their view model is CollectionView, which can synchronize the CurrentItem and CurrentPosition with selected item showed in screen, (setting IsSynchronizedWithCurrentItem=true) ; especially , CurrentPosition is the index of current item showed in screen, it is the visible index, not the index of current item stored in data source backend.
Now I set a binding list which implements ICollectionView to XamDataGrid data source, the collection view is this binding list, I set "IsSynchronizedWithCurrentItem=true", yes, the CurrentItem can synchronize with the active record showed in screen, but CurrentPosition don't synchronize with the visible index;
e.g. if you try to sort the grid (by clicking in the column caption), the data in BindingList which implements ICollectionView doesn’t change, but the records on the grid change (different sorting same data); it seems that the XamDataGrid (the control) keeps its own indexing.
To one word, how the binding list which implements the ICollectionView as data source for XamDataGrid can be fully synchronize with XamDataGrid's view ?
I tried the code likeprivate BindingList<RowModel> datum1 = new BindingList<RowModel>(); FillDataSource(datum1);CollectionViewSource viewSource = new CollectionViewSource();viewSource.Source = datum1;XamDataGrid1.DataSource = viewSource.View;XamDataGrid1.IsSynchronizedWithCurrentItem = true;I see the CurrentItem property of CollectionView is indeed can synchronize with the the active record in XamDataGrid, but CurrentPosition is not synchronize with the visible index, it is still the index in data source. This is not consistence with the wpf control like listbox.
Does the XamDataGrid don't support fully synchronizing with collectionView behind? Plz help me, thanks.
Have u tried using ObservableCollection instead of the BindingList ?
Does anybody know about it?