Back to Devexpress

StyleFormatConditionCollection Class

windowsforms-devexpress-dot-xtratreelist-dot-styleformatconditions-68e3c0f8.md

latest4.4 KB
Original Source

StyleFormatConditionCollection Class

A style condition collection.

Namespace : DevExpress.XtraTreeList.StyleFormatConditions

Assembly : DevExpress.XtraTreeList.v25.2.dll

NuGet Packages : DevExpress.Win.Navigation, DevExpress.Win.TreeList

Declaration

csharp
[ListBindable(false)]
public class StyleFormatConditionCollection :
    FormatConditionCollectionBase
vb
<ListBindable(False)>
Public Class StyleFormatConditionCollection
    Inherits FormatConditionCollectionBase

The following members return StyleFormatConditionCollection objects:

Remarks

The StyleFormatConditionCollection class supports legacy style format conditions. Instead of this feature, we suggest that you use the advanced conditional format rules to highlight cells matching your criteria. These format rules can be created with the TreeList.FormatRules property.

Example

The following example applies conditional formatting to the Tree List nodes. The nodes that have a value in the ‘Budget’ column greater than $100,000 but but less than $400,000, are painted using custom appearance settings. To do this, a new style format condition is created, customized and added to the Tree List’s TreeList.FormatConditions collection.

The image below shows the result.

csharp
using DevExpress.XtraTreeList.StyleFormatConditions;

// ...
// Create a new StyleFormatCondition object.
StyleFormatCondition condition = new StyleFormatCondition(
  DevExpress.XtraGrid.FormatConditionEnum.Between, treeList1.Columns["Budget"], 
  null, 100000, 400000, true);
// Customize the appearance settings used to paint the nodes 
// with cells in the 'Budget' column that have a value greater than 100000
// but less than 400000.
condition.Appearance.BackColor = Color.Orange;
condition.Appearance.BackColor2 = Color.Yellow;
condition.Appearance.GradientMode = System.Drawing.Drawing2D.LinearGradientMode.Vertical;
// Adds the format condition to the Tree List's FormatConditions collection.
treeList1.FormatConditions.Add(condition);
vb
Imports DevExpress.XtraTreeList.StyleFormatConditions

' ...
' Create a new StyleFormatCondition object.
Dim condition As StyleFormatCondition = New StyleFormatCondition( _
  DevExpress.XtraGrid.FormatConditionEnum.Between, TreeList1.Columns("Budget"), _
  Nothing, 100000, 400000, True)
' Customize the appearance settings used to paint the nodes 
' with cells in the 'Budget' column that have a value greater than 100000
' but less than 400000.
condition.Appearance.BackColor = Color.Orange
condition.Appearance.BackColor2 = Color.Yellow
condition.Appearance.GradientMode = System.Drawing.Drawing2D.LinearGradientMode.Vertical
' Adds the format condition to the Tree List's FormatConditions collection.
TreeList1.FormatConditions.Add(condition)

Inheritance

Object CollectionBase FormatConditionCollectionBase StyleFormatConditionCollection

See Also

StyleFormatConditionCollection Members

FormatConditions

DevExpress.XtraTreeList.StyleFormatConditions Namespace