windowsforms-devexpress-dot-xtraeditors-8c91aedd.md
Highlights a cell with a custom icon and/or appearance settings for a limited time when a cell value changes. This format is only supported in Data Grid’s GridView, BandedGridView and AdvBandedGridView.
Namespace : DevExpress.XtraEditors
Assembly : DevExpress.XtraEditors.v25.2.dll
NuGet Package : DevExpress.Win.Navigation
public class FormatConditionRuleDataUpdate :
FormatConditionRuleAppearanceBase,
IFormatRuleContextImage
Public Class FormatConditionRuleDataUpdate
Inherits FormatConditionRuleAppearanceBase
Implements IFormatRuleContextImage
The FormatConditionRuleDataUpdate format allows you to temporarily highlight cells (with icons and/or customized appearance settings) when cell values change, increase or decrease. You can also implement a custom trigger with the GridView.FormatRuleDataUpdateCustomTrigger event.
Note
Currently this format is only supported in the Data Grid control’s GridView, BandedGridView and AdvBandedGridView.
The following are the main properties the FormatConditionRuleDataUpdate format provides.
Use the following properties to set the format’s icon and/or color.
Note
The FormatConditionRuleDataUpdate format is not in effect in the following case:
This example uses a FormatConditionRuleDataUpdate format to temporarily highlight cells when their values increase. The highlight effect includes a custom background color and icon.
XtraGrid.GridFormatRule gridFormatRule = new DevExpress.XtraGrid.GridFormatRule();
DevExpress.XtraEditors.FormatConditionRuleDataUpdate formatConditionRuleDataUpdate = new DevExpress.XtraEditors.FormatConditionRuleDataUpdate();
gridFormatRule.Column = gridView1.Columns["Change"];
gridFormatRule.Name = "Format1";
formatConditionRuleDataUpdate.HighlightTime = 500;
formatConditionRuleDataUpdate.Icon.PredefinedName = "Flags3_1.png";
formatConditionRuleDataUpdate.PredefinedName = "Green Fill";
formatConditionRuleDataUpdate.Trigger = FormatConditionDataUpdateTrigger.ValueIncreased;
gridFormatRule.Rule = formatConditionRuleDataUpdate;
gridView1.FormatRules.Add(gridFormatRule);
Dim gridFormatRule As New DevExpress.XtraGrid.GridFormatRule()
Dim formatConditionRuleDataUpdate As New DevExpress.XtraEditors.FormatConditionRuleDataUpdate()
gridFormatRule.Column = gridView1.Columns("Change")
gridFormatRule.Name = "Format1"
formatConditionRuleDataUpdate.HighlightTime = 500
formatConditionRuleDataUpdate.Icon.PredefinedName = "Flags3_1.png"
formatConditionRuleDataUpdate.PredefinedName = "Green Fill"
formatConditionRuleDataUpdate.Trigger = XtraEditors.FormatConditionDataUpdateTrigger.ValueIncreased
gridFormatRule.Rule = formatConditionRuleDataUpdate
gridView1.FormatRules.Add(gridFormatRule)
The following example creates a FormatConditionRuleDataUpdate format that temporarily highlights a Data Grid cell in the Price column when a cell value is increased by 5%.
DevExpress.XtraGrid.GridFormatRule gridFormatRule = new DevExpress.XtraGrid.GridFormatRule();
DevExpress.XtraEditors.FormatConditionRuleDataUpdate formatConditionRuleDataUpdate = new DevExpress.XtraEditors.FormatConditionRuleDataUpdate();
gridFormatRule.Column = gridView1.Columns["Price"];
gridFormatRule.Name = "priceUp";
formatConditionRuleDataUpdate.HighlightTime = 800;
formatConditionRuleDataUpdate.PredefinedName = "Green Fill, Green Text";
formatConditionRuleDataUpdate.Trigger = DevExpress.XtraEditors.FormatConditionDataUpdateTrigger.Custom;
gridFormatRule.Rule = formatConditionRuleDataUpdate;
gridView1.FormatRules.Add(gridFormatRule);
gridView1.FormatRuleDataUpdateCustomTrigger += gridView1_FormatRuleDataUpdateCustomTrigger;
//...
private void gridView1_FormatRuleDataUpdateCustomTrigger(object sender, Views.Grid.FormatRuleGridDataUpdateTriggerEventArgs e) {
if (e.Rule.Name != "priceUp") return;
double oldVal = Convert.ToDouble(e.OldValue);
double newVal = Convert.ToDouble(e.NewValue);
double diff = (newVal - oldVal) / oldVal;
e.Trigger = diff > 0.05;
}
Dim gridFormatRule As New DevExpress.XtraGrid.GridFormatRule()
Dim formatConditionRuleDataUpdate As New DevExpress.XtraEditors.FormatConditionRuleDataUpdate()
gridFormatRule.Column = GridView1.Columns("Price")
gridFormatRule.Name = "priceUp"
formatConditionRuleDataUpdate.HighlightTime = 800
formatConditionRuleDataUpdate.PredefinedName = "Green Fill, Green Text"
formatConditionRuleDataUpdate.Trigger = DevExpress.XtraEditors.FormatConditionDataUpdateTrigger.Custom
gridFormatRule.Rule = formatConditionRuleDataUpdate
GridView1.FormatRules.Add(gridFormatRule)
AddHandler GridView1.FormatRuleDataUpdateCustomTrigger, AddressOf GridView1_FormatRuleDataUpdateCustomTrigger
'...
Private Sub GridView1_FormatRuleDataUpdateCustomTrigger(sender As Object, e As DevExpress.XtraGrid.Views.Grid.FormatRuleGridDataUpdateTriggerEventArgs)
If e.Rule.Name <> "priceUp" Then Return
Dim oldVal As Double = Convert.ToDouble(e.OldValue)
Dim newVal As Double = Convert.ToDouble(e.NewValue)
Dim diff As Double = (newVal - oldVal) / oldVal
e.Trigger = diff > 0.05
End Sub
The Data Grid control provides a Designer that helps you create format conditions, including the FormatConditionRuleDataUpdate format at design time.
End-users can create and modify FormatConditionRuleDataUpdate formats at runtime provided that the ShowConditionalFormattingItem option is enabled (see GridOptionsMenu.ShowConditionalFormattingItem and TreeListOptionsMenu.ShowConditionalFormattingItem). End-users can invoke a format condition editor from a column header’s context menu.
Note
To visualize changes to cell values, you can also use animated conditional formats. When a cell value changes, the format rule is repainted with an animation effect (a fade effect, progressively filled data bar, etc.). See the FormatConditionRuleBase.AllowAnimation property for information on the formats that support animation effects. All formats except the FormatConditionRuleDataUpdate remain visible until specific criteria are met.
Object FormatConditionRuleBase FormatConditionRuleAppearanceBase FormatConditionRuleDataUpdate
See Also
FormatConditionRuleDataUpdate Members