Back to Devexpress

FormatConditionBase.PredefinedFormatName Property

wpf-devexpress-dot-xpf-dot-grid-dot-formatconditionbase.md

latest4.8 KB
Original Source

FormatConditionBase.PredefinedFormatName Property

Gets or sets the name of the predefined format to be applied to the cells. This is a dependency property.

Namespace : DevExpress.Xpf.Grid

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

NuGet Package : DevExpress.Wpf.Grid.Core

Declaration

csharp
public string PredefinedFormatName { get; set; }
vb
Public Property PredefinedFormatName As String

Property Value

TypeDescription
String

A String value that is the predefined format name.

|

Remarks

The table below presents the collections that store predefined formats.

Conditional FormatPredefined Formats Collection
Basic conditional formatsTableView.PredefinedFormats (TreeListView.PredefinedFormats)
Data UpdateTableView.PredefinedFormats (TreeListView.PredefinedFormats)
Icon SetsTableView.PredefinedIconSetFormats (TreeListView.PredefinedIconSetFormats)
Color ScalesTableView.PredefinedColorScaleFormats (TreeListView.PredefinedColorScaleFormats)
Data BarsTableView.PredefinedDataBarFormats (TreeListView.PredefinedDataBarFormats)

You cannot modify a predefined format collection. To define a new predefined format, create a new predefined format collection.

The following code sample illustrates how to create a collection of predefined formats in markup:

xaml
<dxg:TableView AllowConditionalFormattingMenu="True">
   <dxg:TableView.PredefinedFormats>
      <dx:FormatInfoCollection>
         <dx:FormatInfo FormatName="PurpleFill" DisplayName="Purple Fill">
            <dx:FormatInfo.Format>
               <dxg:Format Background="Purple"/>
            </dx:FormatInfo.Format>
         </dx:FormatInfo>
      </dx:FormatInfoCollection>
   </dxg:TableView.PredefinedFormats>
   <!----> 
</dxg:TableView>

The code sample below illustrates how to create a collection of predefined formats in code-behind:

csharp
FormatInfoCollection predefinedFormats = new FormatInfoCollection();
foreach (FormatInfo formatInfo in view.PredefinedFormats) {
   predefinedFormats.Add(formatInfo);
}
predefinedFormats.Add(new FormatInfo() {
   FormatName = "PurpleFill",
   DisplayName = "Purple Fill",
   Format = new Format() {
      Background = Brushes.Purple
   }
});
view.PredefinedFormats = predefinedFormats;

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the PredefinedFormatName 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-apply-conditional-formatting/CS/ConditionalFormatting/MainWindow.xaml#L22

xml
<dxg:TableView.FormatConditions>
    <dxg:DataBarFormatCondition FieldName="Sales" PredefinedFormatName="RedGradientDataBar"/>
    <dxg:TopBottomRuleFormatCondition Expression="[Sales]" Rule="TopPercent" Threshold="10" PredefinedFormatName="BoldText"/>

See Also

Conditional Formats

FormatConditionBase Class

FormatConditionBase Members

DevExpress.Xpf.Grid Namespace