Skip to main content

BaseEditSettings.DisplayFormat Property

Gets or sets the pattern used to format the editor’s display value. This is a dependency property.

Namespace: DevExpress.Xpf.Editors.Settings

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

NuGet Package: DevExpress.Wpf.Core

Declaration

public string DisplayFormat { get; set; }

Property Value

Type Description
String

A String value that is the format pattern.

Property Paths

You can access this nested property as listed below:

Object Type Path to DisplayFormat
BarEditItem
.EditSettings .DisplayFormat
FilterField
.EditSettings .DisplayFormat
ColumnBase
.ActualEditSettings .DisplayFormat
ColumnBase
.EditSettings .DisplayFormat
TreeViewControl
.EditSettings .DisplayFormat
PropertyDefinition
.EditSettings .DisplayFormat
SpreadsheetCustomCellEditEventArgs
.EditSettings .DisplayFormat

Remarks

Use the DisplayFormat property to format the editor’s value or add text. The formatted text is displayed if the editor’s value is not being edited (the editor is not focused or read-only). To format the editor’s value when it is focused, use Masked Input.

For example, set the DisplayFormat property to c2 to display currency values. If the editor’s value is 99.9, its formatted equivalent is $99.90.

Note

An editor’s value is formatted using string.Format("{0:DisplayFormat}", BaseEdit.EditValue). The display format should match the value’s type (see Example 1); otherwise, the format is ignored (see Example 2).

Example 1

<dxe:ButtonEdit DisplayFormatString="c2" IsReadOnly="True">
    <dxe:ButtonEdit.EditValue>
        <sys:Double>99.9</sys:Double>
    </dxe:ButtonEdit.EditValue>
</dxe:ButtonEdit>

Example 2

<dxe:ButtonEdit DisplayFormatString="c2" IsReadOnly="True" EditValue="99.9" />

Note

Refer to the Format Specifiers topic for more information on the available DisplayFormat values.

The following code snippets (auto-collected from DevExpress Examples) contain references to the DisplayFormat 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.

See Also