【问题标题】:Devexpress GridControl Format ConditionsDevexpress GridControl 格式条件
【发布时间】:2011-12-02 08:42:25
【问题描述】:

有没有使用 Devexpress GridControl 经验的人。

我有一个类,其中有一个对象列表。 (此类绑定到网格)。 该网格有几列用于显示该类。

当 objects.count 的列表 > 1 时,我希望一行具有另一种颜色

我尝试创建一个 In-Place Editor Repository LookUpEdit 项目,以便将对象列表设置为一列。

DevExpress 系列:Winforms

【问题讨论】:

  • 您使用什么系列的 devex 组件? ASP.NET、WPF、WinForms?

标签: winforms gridview devexpress


【解决方案1】:

很少有methods 可以满足您的需求。您可以使用更灵活的Appearance specific events

检查Customizing Appearances of Individual Rows and Cells on devExpress 文档。

检查一下如何根据某些列值有条件地更改外观:

using DevExpress.XtraGrid.Views.Grid;

private void gridView1_RowStyle(object sender, 
DevExpress.XtraGrid.Views.Grid.RowStyleEventArgs e) {
   GridView View = sender as GridView;
   if(e.RowHandle >= 0) {
      string category = View.GetRowCellDisplayText(e.RowHandle, View.Columns["Category"]);
      if(category == "Beverages") {
         e.Appearance.BackColor = Color.Salmon;
         e.Appearance.BackColor2 = Color.SeaShell;
      }            
   }
}

【讨论】:

  • 谢谢伙计,我看了@那个,但我认为它只适用于 CellStyling。但它适用于第 2 行。我会试试这个;)
猜你喜欢
  • 2016-07-03
  • 1970-01-01
  • 2012-05-22
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多