.NET Framework 4.5.2+
.NET Framework 4.5.2+
.NET Standard 2.0+
.NET 5.0+

PropertyEditor.DisplayFormat Property

Specifies the display format string for the Property Editor’s value.

Namespace: DevExpress.ExpressApp.Editors

Assembly: DevExpress.ExpressApp.v21.2.dll

Declaration

public string DisplayFormat { get; set; }

Property Value

Type Description
String

The format string for the Property Editor’s value.

Remarks

The DisplayFormat property uses a syntax similar to that in String.Format() method calls. If a Property Editor displays date-time values, you can apply the following format string: Due Date: {0:MMM/d/yyyy hh:mm tt}:

Display Format

The DisplayFormat property value can contain literal characters (displayed as is) and a value placeholder. In the format string example above, the Due Date: text is displayed as is. The value placeholder is {0:MMM/d/yyyy hh:mm tt}.

The placeholder syntax is {0[:formatString]}. Since a Property Editor contains a single value, the index is always 0. The formatString portion is optional. It sets Format Specifiers that determine how the editor converts its value into display text.

You can set the DisplayFormat property in the Application Model. Locate the View Item node that corresponds to the Property Editor. In that node, set the DisplayFormat property value. The following topic gives an example of how you can do this in the Model Editor: Apply the Display Format to an Integer Property Value.

You can also set the DisplayFormat property in Controller code:

public partial class ViewController1 : ViewController<DetailView> {
    // ...
    protected override void OnActivated() {
        base.OnActivated();
        var editor = View.FindItem("ZipPostal") as ASPxStringPropertyEditor;
        editor.DisplayFormat = "Zip Code: {0}";
    }
    // ...
}

For more information on how to access editors in code, see the following topic: Access Editor Settings.

If you create a custom Property Editor that should support the DisplayFormat property, implement your logic to apply the DisplayFormat property value to the custom editor.

The following code snippet (auto-collected from DevExpress Examples) contains a reference 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