Hey guys,
I'm trying to sync my selected gridview row with the ICollectionView. I have installed an older version (2010.2.924.35) and the new version 2011.2.712.35. The same implementation works with the older version and don't works with the new version.
So, let have a look at my code:
The code of the ViewModel:
The XAML-Code:
The Items the ItemsView contains are correctly displayed in the GridView. But the
What can I do to get it work?
Thank you very much!
Best regards from Germany
I'm trying to sync my selected gridview row with the ICollectionView. I have installed an older version (2010.2.924.35) and the new version 2011.2.712.35. The same implementation works with the older version and don't works with the new version.
So, let have a look at my code:
The code of the ViewModel:
#region Deklarationenprivate ObservableCollection<RWF_GUI_TransferItems> _Items;/// <summary>/// Enthält alle Elemente die in dem GridView dargestellt werden./// </summary>public ObservableCollection<RWF_GUI_TransferItems> Items{ get { return _Items; } set { _Items = value; this.ValueChanged("Items"); }}private ICollectionView _ItemsView;/// <summary>/// View zur Überwachtung des aktuellen Grid-Items/// </summary>public ICollectionView ItemsView{ get { return _ItemsView; } set { _ItemsView = value; this.ValueChanged("ItemsView"); }}private RWF_GUI_TransferItems _AktuelleGridAuswahl;/// <summary>/// Aktuelle Gridzeile/// </summary>public RWF_GUI_TransferItems AktuelleGridAuswahl{ get { return _AktuelleGridAuswahl; } set { _AktuelleGridAuswahl = value; this.ValueChanged("AktuelleGridAuswahl"); }}public MainViewModel(){ this.Items = new ObservableCollection<RWF_GUI_TransferItems>(); this.ItemsView = CollectionViewSource.GetDefaultView(this.Items); this.ItemsView.CurrentChanged += new EventHandler(OnCurrentItemChanged);}void OnCurrentItemChanged(object sender, EventArgs e){ this.AktuelleGridAuswahl = (RWF_GUI_TransferItems)this.ItemsView.CurrentItem;}The XAML-Code:
<telerik:RadGridView ItemsSource="{Binding ItemsView}" RowHeight="25" CanUserFreezeColumns="False" AutoGenerateColumns="False" ShowColumnFooters="true" x:Name="GridViewMain" IsSynchronizedWithCurrentItem="True" IsEnabled="{Binding AtWork, Converter={StaticResource NegateBoolConverter}}">The Items the ItemsView contains are correctly displayed in the GridView. But the
OnCurrentItemChanged-Event is only being raised on startup (this.ItemsView.CurrentItem is null at this moment).What can I do to get it work?
Thank you very much!
Best regards from Germany