
现在我想根据程序启动时的行内容以及运行时是否有变化来为行着色.
System.windows.Controls.DataGrID areaDataGrID = ...;ObservableCollection<Area> areas;//adding items to areas collectionareaDataGrID.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?} 如何在启动和运行时访问行?
解决方法 使用RowStyle.您可以使用 Triggers有条件地更改颜色,或者只是将其绑定到项目的Brush属性并分别更改该属性. 总结 以上是内存溢出为你收集整理的c# – 更改WPF Datagrid行颜色全部内容,希望文章能够帮你解决c# – 更改WPF Datagrid行颜色所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)