Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

TreeListView.CustomDataUpdateFormatCondition Event

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

Namespace: DevExpress.Xpf.Grid

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

NuGet Package: DevExpress.Wpf.Grid.Core

#Declaration

public event EventHandler<CustomDataUpdateFormatConditionEventArgs> CustomDataUpdateFormatCondition

#Event Data

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

Property Description
Allow Gets or sets whether the formatting should be applied to a processed cell (row).
Condition Gets the currently processed format condition.
NewValue Gets the new cell value.
OldValue Gets 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 TableView.CustomDataUpdateFormatCondition) event.

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

private void view_CustomDataUpdateFormatCondition(object sender, CustomDataUpdateFormatConditionEventArgs e) {
   if((decimal)e.NewValue < 0)
      e.Allow = true;
   e.Condition.ApplyToRow = true;
}
See Also