BaseEdit.DisplayFormatString 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
Assembly: DevExpress.Xpf.Core.v24.2.dll
NuGet Package: DevExpress.Wpf.Core
Declaration
Property Value
Type | Description |
---|---|
String | A String value that is the format pattern. |
Remarks
Use the DisplayFormatString
property to format the editor’s value and placeholder text. The formatted text is displayed if the editor’s value is not currently edited (for example, if the editor is not focused or it is read-only). Refer to the following help topic for more information: Format Specifiers.
For example, set the DisplayFormatString
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 specified display format should match the value’s type (Example 1). Otherwise, it is ignored (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>
Related GitHub Examples
The following code snippets (auto-collected from DevExpress Examples) contain references to the DisplayFormatString 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.