Skip to main content
A newer version of this page is available. .
.NET Framework 4.5.2+

PropertyEditor.DisplayFormat Property

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

Namespace: DevExpress.ExpressApp.Editors

Assembly: DevExpress.ExpressApp.v21.2.dll

NuGet Package: DevExpress.ExpressApp

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.

See Also