我有一个 WPF 数据网格,其中填充了一个 ObserverableCollection。
现在我想根据程序启动时的行内容以及运行时是否发生变化来为行着色。
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?
}
如何在开始和运行时访问行?
最佳答案
关于c# - 更改 WPF 数据网格行颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10056657/