Back to Devexpress

FormatConditionCollection.AddRange(IEnumerable<FormatConditionBase>) Method

wpf-devexpress-dot-xpf-dot-grid-dot-formatconditioncollection-dot-addrange-x28-system-dot-collections-dot-generic-dot-ienumerable-devexpress-dot-xpf-dot-grid-dot-formatconditionbase-x29.md

latest3.9 KB
Original Source

FormatConditionCollection.AddRange(IEnumerable<FormatConditionBase>) Method

Adds a range of conditional formats to the collection.

Namespace : DevExpress.Xpf.Grid

Assembly : DevExpress.Xpf.Grid.v25.2.Core.dll

NuGet Package : DevExpress.Wpf.Grid.Core

Declaration

csharp
public void AddRange(
    IEnumerable<FormatConditionBase> conditionals
)
vb
Public Sub AddRange(
    conditionals As IEnumerable(Of FormatConditionBase)
)

Parameters

NameTypeDescription
conditionalsIEnumerable<FormatConditionBase>

A range of conditional formats.

|

Remarks

The following code sample adds conditional formats to the TableView.FormatConditions collection:

csharp
view.FormatConditions.AddRange(new List<FormatConditionBase> {
    new FormatCondition() { 
        FieldName = "ModelPrice", 
        ValueRule=ConditionRule.Greater, 
        Value1="50000", 
        PredefinedFormatName="LightRedFillWithDarkRedText" 
    },
    new IconSetFormatCondition () { 
        FieldName = "Discount", 
        PredefinedFormatName = "Stars3IconSet" 
    }
});

The collection contains the Add and AddRange methods to add conditional formats:

  • When you use the Add methods, each method call updates the GridControl. To improve performance of adding operations, enclose the changes within the BeginUpdate and EndUpdate method calls. In this case, the GridControl is updated after the last call.
  • When you use the AddRange method, the method call updates the GridControl after all conditional formats are added. You do not need to enclose the changes within the BeginUpdate and EndUpdate method calls.

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the AddRange(IEnumerable<FormatConditionBase>) method.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

how-to-apply-conditional-formatting-in-code-behind-t281415/CS/ConditionalFormatting/MainWindow.xaml.cs#L11

csharp
InitializeComponent();
view.FormatConditions.AddRange(new List<FormatConditionBase> {
    new DataBarFormatCondition() {

See Also

TableView.FormatConditions

TreeListView.FormatConditions

FormatConditionCollection Class

FormatConditionCollection Members

DevExpress.Xpf.Grid Namespace