Skip to main content

BaseEditSettings.DisplayFormat Property

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

Namespace: DevExpress.Xpf.Editors.Settings

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

#Declaration

[SkipPropertyAssertion]
public string DisplayFormat { get; set; }

#Property Value

Type Description
String

A String value that is the format pattern.

#Property Paths

You can access the BaseEditSettings.DisplayFormat property from the following objects:

Object Type Path to DisplayFormat
BarEditItem
.EditSettings.DisplayFormat
ColumnBase
.ActualEditSettings.DisplayFormat
ColumnBase
.EditSettings.DisplayFormat
GridColumn
.ActualEditSettings.DisplayFormat
GridColumn
.EditSettings.DisplayFormat
TreeListColumn
.ActualEditSettings.DisplayFormat
TreeListColumn
.EditSettings.DisplayFormat

#Remarks

Use the DisplayFormat property to format the editor's value and add any text to its textual representation. The formatted text is displayed if the editor's value is not currently edited (e.g. the editor is not focused or it is read-only).

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

NOTE

An editor's value is formatted using string.Format("{0:DisplayFormat}, BaseEdit.EditValue). The specified display format should match the value's type (Example 1). Otherwise, it is ignored and is not applied (Example 2).

Example 1:


<dxe:ButtonEdit DisplayFormatString="c" IsReadOnly="True">
            <dxe:ButtonEdit.EditValue>
                <sys:Double>123</sys:Double>
            </dxe:ButtonEdit.EditValue>
        </dxe:ButtonEdit>

Example 2:


<dxe:ButtonEdit DisplayFormatString="c" IsReadOnly="True" EditValue="123">
        </dxe:ButtonEdit>
See Also