wpf-devexpress-dot-xpf-dot-grid-dot-tableview-aa5eefdd.md
Stores conditional formats applied to the TableView.
Namespace : DevExpress.Xpf.Grid
Assembly : DevExpress.Xpf.Grid.v25.2.dll
NuGet Package : DevExpress.Wpf.Grid.Core
public FormatConditionCollection FormatConditions { get; }
Public ReadOnly Property FormatConditions As FormatConditionCollection
| Type | Description |
|---|---|
| FormatConditionCollection |
A FormatConditionCollection object that is the collection of conditional formats applied to the grid’s view.
|
The FormatConditions collection stores conditional formatting rules applied to the grid’s view.
The following code sample illustrates how to define a conditional formatting rule in markup:
<dxg:TableView.FormatConditions>
<dxg:DataBarFormatCondition FieldName="Visits" PredefinedFormatName="GreenGradientDataBar" />
</dxg:TableView.FormatConditions>
View Example: Apply Conditional Formatting
The code sample below illustrates how to define the same conditional formatting rule in code-behind:
var visitsDataBar = new DataBarFormatCondition() {
FieldName = "Visits",
PredefinedFormatName = "GreenGradientDataBar"
};
view.FormatConditions.Add(visitsDataBar);
Dim visitsDataBar = New DataBarFormatCondition() With {
.FieldName = "Visits",
.PredefinedFormatName = "GreenGradientDataBar"
}
view.FormatConditions.Add(visitsDataBar)
View Example: Apply Conditional Formatting in Code Behind
Use the following methods to remove conditional formatting rules:
The following code snippets (auto-collected from DevExpress Examples) contain references to the FormatConditions property.
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.
wpf-data-grid-disable-rows-based-on-their-values/CS/WpfApplication/MainWindow.xaml#L44
<dxg:TableView.FormatConditions>
<dxg:FormatCondition Expression="![AllowEdit]">
wpf-data-grid-apply-conditional-formatting/CS/ConditionalFormatting/MainWindow.xaml#L21
<dxg:TableView AllowConditionalFormattingMenu="True">
<dxg:TableView.FormatConditions>
<dxg:DataBarFormatCondition FieldName="Sales" PredefinedFormatName="RedGradientDataBar"/>
wpf-grid-scrollbar-annotations/CS/WpfApplication25/MainWindow.xaml#L30
<dxg:TableView x:Name="myView" AllowPerPixelScrolling="True" ShowSearchPanelMode="Always" ScrollBarAnnotationMode="{Binding EditValue, ElementName= myListBoxEdit, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay }" ScrollBarCustomRowAnnotation ="MyScrollBarCustomRowAnnotationEventHandler" SearchPanelAllowFilter="False" Loaded="MyLoadedEventHandler">
<dxg:TableView.FormatConditions>
<dxg:FormatCondition Expression="[Number] > 2.0m and [Number] < 4.0m" FieldName="Number" ApplyToRow="True">
See Also
AddFormatCondition(FormatConditionBase)
ClearFormatConditionsFromColumn(ColumnBase)