偶数行的外观是否会覆盖某些行的自定义外观?
让我们弄清楚这里的情况。 让我们以 WIN 形式创建一个 devexpress 的 gridview 控件。让我们将网格偶数行的外观设置为背景颜色= color.whiteSmoke(据说是为了帮助用户轻松区分行)。我们在设计时这样做。 现在,让我们以编程方式将一些与我在事件中的条件相匹配的行设置为红色:gridView_RowStyle。
问题是,符合我的条件的偶数行仍然是白烟色?!?!?
这是否意味着偶数行的外观被覆盖为自定义外观???
我不明白。 我应该做什么才能使符合我的条件的行显示为红色?
Let's clear the situation in here.
Let's have a devexpress's gridview control in a WIN form. Let's set the Appearance of the Even rows of the grid have the backcolor = color.whiteSmoke (say to help the users distiguish the rows easily). We do this in design time.
Now, let's do programmatically color in red some rows that match my condition in an event: gridView_RowStyle.
The problem is than the even rows, matching my condition are still colored in whitesmoke?!?!?
Does that mean that the appearance of the even rows are overwritten to the custom appearance???
I'm not getting that.
What I'm I supposed to do so that the rows that match my condition are colored in red?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
嗯,很明显,是的,偶数行的外观被覆盖为我在 RowStyle 事件中着色的行的外观。
避免覆盖的解决方案是使用 DevExpress.XtraGrid.StyleFormatCondition 对象,同时以编程方式绑定网格,如下例所示:
这确实解决了我的问题。希望它对某人有帮助。
Well, as it was obvious, yes, the appearance of the even rows was overwritten to the appearance of the rows I colored at the RowStyle event.
The solution, so that the overwritten is avoided is the use of the DevExpress.XtraGrid.StyleFormatCondition object, while programmatically binding the grid, as in the following example:
This did solve my problem. Hope it helps somebody.