Gird. FieldName="m";
Gird. VisibleIndex=0;
Gird. Width=15;
Enclosing gridView1. Columns. The Add (gird);
GridFormatRule gfrid=new GridFormatRule {Name="gfrid"};
Gfrid. Column=gird;
Gfrid. Rule=new FormatConditionRuleExpression ()
{
PredefinedName="Red Fill, Red Text",
Expression="[m] & gt; 0,
"};
Enclosing gridView1. FormatRules. Add (gfrid);
The above is a line of data is generated by the code and add rules but there is no effective
pageIn the
In the rule set directly Settings take effect no
Page effect the following
CodePudding user response:
Didn't find what problems
Private void button3_Click (object sender, EventArgs e)
{
_lst. Add (new BillModel
{
Amount=1028,
Name="1" goods,
Price=150,
Qty=3
});
_lst. Add (new BillModel
{
Amount=3028,
Name="2" goods,
Price=110,
Qty=35
});
Var formatExpress=new DevExpress. XtraEditors. FormatConditionRuleExpression ();
Var formatRule=new DevExpress. The XtraGrid. GridFormatRule ();
FormatRule. ApplyToRow=true;
FormatRule. Column=gridView1. Columns (" amount ");
FormatRule. Name="t1500";
FormatExpress. Appearance. BackColor=Color. LightGreen;
FormatExpress. Appearance. BorderColor=Color. Red;
FormatExpress. Expression="[amount] & gt; 1500 ";
FormatRule.=formatExpress Rule;
GridView1. FormatRules. Add (formatRule);
GridView1. RefreshData ();
}
Public class BillModel
{
Public string name {get; The set; }
Public int qty {get; The set; }
Public decimal price {get; The set; }
Public decimal amount {get; The set; }
}
CodePudding user response:
Problem I found myself, to find the official documentation. Because when I page generated automatically adds a row data column added color. Lead to reduced the priority of the Rule set colors. There is no effect. In the Rule. The options. HighPriority=true the highest priority setting to take effect