在gridcontrol devexpress中添加新的自定义列 [英] Add new custom column in gridcontrol devexpress

查看:1122
本文介绍了在gridcontrol devexpress中添加新的自定义列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Devexpress的新手。现在我需要任何人的帮助才能继续。我在Windows应用程序中有一个gridcontrol。 gridcontrol中的数据使用EntityFramework无限制。里面有很多列。有两列名为AmountDroppped和TransactionAmount。我需要添加另一列来显示这些列之间的差异,如果此自定义列值大于400INR,我想使整行变红。有没有办法在不使用代码隐藏和存储过程的情况下执行此操作。希望可能有一个。

I am new to Devexpress. Now i need help from anybody to go ahead. I have a gridcontrol in a windows application. The Data inside the gridcontrol is unbounded using EntityFramework. There are plenty of columns inside it. There are two columns named AmountDroppped and TransactionAmount. I need to add another columns to display the difference between these columns and i wanna make reddish the whole row if this custom column value is greater than 400INR. Is there any way to do this without using code behind and stored procedure. Hope there might be a one.

推荐答案

这些可能会有所帮助 -

https://documentation.devexpress.com/#WindowsForms/CustomDocument1477 [ ^ ]

https://documentation.devexpress .com /#WPF / CustomDocument6094 [ ^ ]



您可能还想查看DevExpress论坛。
These might help -
https://documentation.devexpress.com/#WindowsForms/CustomDocument1477[^]
https://documentation.devexpress.com/#WPF/CustomDocument6094[^]

You might also want to check DevExpress forums.


using DevExpress.XtraGrid.Columns;
//...
GridColumn columnDiff = new GridColumn();
columnDiff.FieldName = "amountDiff";
columnDiff.Caption = "Diff";
columnDiff.UnboundType = DevExpress.Data.UnboundColumnType.Decimal;
columnDiff.UnboundExpression = "[TransactionAmount] - [AmountDroppped]";
gridView1.Columns.Add(columnDiff);





要有条件地突出显示某些特定行,我建议您使用样式格式条件功能:





To conditionally highlight some specific rows I suggest you use the Style Format Conditions feature:

using DevExpress.XtraGrid;


StyleFormatCondition condition = new DevExpress.XtraGrid.StyleFormatCondition();
condition.Appearance.BackColor = Color.Red;
condition.Appearance.Options.UseBackColor = true;
condition.ApplyToRow = true;
condition.Condition = FormatConditionEnum.Expression;
condition.Expression = "([TransactionAmount] - [AmountDroppped]) > 400";
gridView1.FormatConditions.Add(condition);


这篇关于在gridcontrol devexpress中添加新的自定义列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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