WPF c#突出显示范围内的datagrid行 [英] WPF c# Highlight datagrid rows in range

查看:95
本文介绍了WPF c#突出显示范围内的datagrid行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hello Code项目.
需要帮忙.我有自动生成列为false的datagrid.列是从后面的代码添加的(底部,我将上传屏幕快照),因此我需要突出显示日期范围内的行,例如,从31/8/2011 04/9/2011开始,其中房间号= 777.我真的需要帮助:)请:)
http://imageshack.us/photo/my-images/641/captureqg.jpg/ [ ^ ]


我们使用telerik控件,它们具有cellstyleselector概念,该概念会根据bount对象的内容更改单元格格式.

如果不使用telerik,则需要管理数据中的网格单元状态.这意味着您需要向数据收集中添加一个字段,该字段可以计算出来以管理单元格格式.然后将单元格属性(前景/背景等)绑定到该字段.

您不应该做的一件事是使用cellchanged事件来管理格式,始终将UI管理基于集合或视图模型中的数据字段.


Hello Code Project.
Need Help. i have datagrid with auto generate columns false. Columns are adding from code behind(bottom i will upload screenshot) So i need to Highlight rows in date range for example from 31/8/2011 04/9/2011 where room number = 777 . I really need a help :) please :)
http://imageshack.us/photo/my-images/641/captureqg.jpg/[^]

解决方案

I come from a Silverlight perspective so these are just ideas to follow until someone more WPF oriented answers.

We use the telerik controls and they have a cellstyleselector concept that changes the cell format based on the content of the bount object.

If you are not using telerik then you need to manage the grid cell state in your data. This means you need to add a field to you data collection that can be calculated to manage the cell format. You then bind the cell property (foreground/background etc) to that field.

One thing you should NOT do is use the cellchanged events to manage the format, alway base your UI management on a data field in you collection or the viewmodel.


这篇关于WPF c#突出显示范围内的datagrid行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆