Skip to main content

DataFormTextEditorWithAffixAttributeBase.DisplayFormat Property

Gets or sets the format string for the editor’s value.

Namespace: DevExpress.Maui.DataForm

Assembly: DevExpress.Maui.Editors.dll

NuGet Package: DevExpress.Maui.Editors

Declaration

public string DisplayFormat { get; set; }

Property Value

Type Description
String

A format string.

Remarks

Use the DisplayFormat property to format the editor value and add additional text. The pattern has the following structure:

<custom static text>{0:<format specifier<precision specifier>>}<custom static text>

  • {0} – The editor value’s placeholder.
  • format specifier – The format type (currency, scientific, and so on).
  • precision specifier – The number of characters displayed after the decimal point.

Refer to the following pages for more information about format specifiers:

The following example shows how to format the display value for a Data Form’s numeric editor:

DevExpress MAUI DataForm - Formatted numeric value

public class DataInfo : INotifyPropertyChanged {
    double numValue;
    [DataFormDisplayOptions(EditorWidth = "300", SkipAutoGenerating = false)]
    [DataFormItemPosition(RowOrder = 0)]
    [DataFormNumericEditor(ClearIconVisibility = IconVisibility.Always, ReturnType = ReturnType.Next,
        AllowLooping = false, AllowNullValue = true, 
        IsUpDownIconVisible = true, DisplayFormat = "Value: {0:f2}",
        MinValue = 1, MaxValue = 100, StepValue = 0.1)]
    public double NumericValue {
        get { return this.numValue; }
        set {
            if (value != this.numValue) {
                this.numValue = value;
                NotifyPropertyChanged();
            }
        }
    }
    public event PropertyChangedEventHandler PropertyChanged;
    private void NotifyPropertyChanged([CallerMemberName] string propertyName = "") {
        PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
    }
}
<dxdf:DataFormView x:Name="dataForm" 
                   CommitMode="Input" 
                   IsAutoGenerationEnabled="True">
    <dxdf:DataFormView.DataObject>
        <local:DataInfo/>
    </dxdf:DataFormView.DataObject>
</dxdf:DataFormView>
See Also