我有一个充满ObserverableCollection的
WPF数据网格.
现在我想根据程序启动时的行内容以及运行时是否有变化来为行着色.
System.Windows.Controls.DataGrid areaDataGrid = ...; ObservableCollection<Area> areas; //adding items to areas collection areaDataGrid.ItemsSource = areas; areaDataGrid.Rows <-- Property not available. how to access rows here? CollectionView myCollectionView = (CollectionView)CollectionViewSource.GetDefaultView(areaDataGrid.Items); ((INotifyCollectionChanged)myCollectionView).CollectionChanged += new NotifyCollectionChangedEventHandler(areaDataGrid_Changed); ... void areaDataGrid_Changed(object sender,NotifyCollectionChangedEventArgs e) { //how to access changed row here? }
如何在启动和运行时访问行?