Back to Devexpress

TableView.CustomDataUpdateFormatCondition Event

wpf-devexpress-dot-xpf-dot-grid-dot-tableview-894f122e.md

latest3.2 KB
Original Source

TableView.CustomDataUpdateFormatCondition Event

Allows defining a custom logic of conditional formatting of the changed grid cells (rows).

Namespace : DevExpress.Xpf.Grid

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

NuGet Package : DevExpress.Wpf.Grid.Core

Declaration

csharp
public event EventHandler<CustomDataUpdateFormatConditionEventArgs> CustomDataUpdateFormatCondition
vb
Public Event CustomDataUpdateFormatCondition As EventHandler(Of CustomDataUpdateFormatConditionEventArgs)

Event Data

The CustomDataUpdateFormatCondition event's data class is CustomDataUpdateFormatConditionEventArgs. The following properties provide information specific to this event:

PropertyDescription
AllowGets or sets whether the formatting should be applied to a processed cell (row).
ConditionGets the currently processed format condition.
NewValueGets the new cell value.
OldValueGets the previous cell value.

Remarks

Use the DataUpdateFormatCondition.Rule property to set a rule that determines whether the data update formatting is applied.

To define a custom logic, set the DataUpdateFormatCondition.Rule property to DataUpdateRule.Custom and handle the CustomDataUpdateFormatCondition (or TreeListView.CustomDataUpdateFormatCondition) event.

The code sample below shows how to define a custom logic for conditional formatting.

xaml
<dxg:TableView x:Name="view" CustomDataUpdateFormatCondition="view_CustomDataUpdateFormatCondition">
   <dxg:TableView.FormatConditions>
      <dxg:DataUpdateFormatCondition FieldName="DeltaPrice" Rule="Custom" PredefinedFormatName="LightRedFillWithDarkRedText" />
   </dxg:TableView.FormatConditions>
</dxg:TableView>
csharp
private void view_CustomDataUpdateFormatCondition(object sender, CustomDataUpdateFormatConditionEventArgs e) {
   if((decimal)e.NewValue < 0)
      e.Allow = true;
   e.Condition.ApplyToRow = true;
}

See Also

Formatting Changing Values

TableView Class

TableView Members

DevExpress.Xpf.Grid Namespace