menu

MAUI

  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class DataFormMaskedTextItem - MAUI API Reference | Syncfusion

    Show / Hide Table of Contents

    Class DataFormMaskedTextItem

    Represents the class that encapsulates the layout and masked text editor(SfMaskedEntry) settings for data field.

    Inheritance
    System.Object
    DataFormViewItem
    DataFormItem
    DataFormTextEditorItem
    DataFormMaskedTextItem
    Inherited Members
    DataFormItem.Background
    DataFormItem.BackgroundProperty
    DataFormItem.DefaultLayoutSettings
    DataFormItem.DefaultLayoutSettingsProperty
    DataFormItem.EditorHeight
    DataFormItem.EditorHeightProperty
    DataFormItem.EditorTextStyle
    DataFormItem.EditorTextStyleProperty
    DataFormItem.ErrorLabelTextStyle
    DataFormItem.ErrorLabelTextStyleProperty
    DataFormItem.FieldName
    DataFormItem.FieldNameProperty
    DataFormItem.GetValue()
    DataFormItem.GroupName
    DataFormItem.GroupNameProperty
    DataFormItem.IsReadOnly
    DataFormItem.IsReadOnlyProperty
    DataFormItem.IsValid
    DataFormItem.ItemsOrderInRow
    DataFormItem.ItemsOrderInRowProperty
    DataFormItem.LabelText
    DataFormItem.LabelTextProperty
    DataFormItem.LabelTextStyle
    DataFormItem.LabelTextStyleProperty
    DataFormItem.LayoutType
    DataFormItem.LayoutTypeProperty
    DataFormItem.LeadingView
    DataFormItem.LeadingViewPosition
    DataFormItem.LeadingViewPositionProperty
    DataFormItem.LeadingViewProperty
    DataFormItem.OnBindingContextChanged()
    DataFormItem.PlaceholderColor
    DataFormItem.PlaceholderColorProperty
    DataFormItem.PlaceholderText
    DataFormItem.PlaceholderTextProperty
    DataFormItem.PropertyInfo
    DataFormItem.SetValue(Object)
    DataFormItem.ShowErrorLabel
    DataFormItem.ShowErrorLabelProperty
    DataFormItem.ShowLabel
    DataFormItem.ShowLabelProperty
    DataFormItem.ShowLeadingView
    DataFormItem.ShowLeadingViewProperty
    DataFormItem.ShowTrailingView
    DataFormItem.ShowTrailingViewProperty
    DataFormItem.ShowValidMessageLabel
    DataFormItem.ShowValidMessageLabelProperty
    DataFormItem.TextInputLayoutSettings
    DataFormItem.TextInputLayoutSettingsProperty
    DataFormItem.TrailingView
    DataFormItem.TrailingViewPosition
    DataFormItem.TrailingViewPositionProperty
    DataFormItem.TrailingViewProperty
    DataFormItem.ValidMessageLabelTextStyle
    DataFormItem.ValidMessageLabelTextStyleProperty
    DataFormTextEditorItem.Keyboard
    DataFormTextEditorItem.KeyboardProperty
    DataFormTextEditorItem.MaxLength
    DataFormTextEditorItem.MaxLengthProperty
    DataFormViewItem.ColumnSpan
    DataFormViewItem.ColumnSpanProperty
    DataFormViewItem.IsVisible
    DataFormViewItem.IsVisibleProperty
    DataFormViewItem.OnPropertyChanged(String)
    DataFormViewItem.Padding
    DataFormViewItem.PaddingProperty
    DataFormViewItem.RowOrder
    DataFormViewItem.RowOrderProperty
    DataFormViewItem.RowSpan
    DataFormViewItem.RowSpanProperty
    Namespace: Syncfusion.Maui.DataForm
    Assembly: Syncfusion.Maui.DataForm.dll
    Syntax
    public class DataFormMaskedTextItem : DataFormTextEditorItem, IThemeElement
    Remarks

    The Syncfusion.Maui.DataForm.DataFormMaskedTextEditor is applied by default for PhoneNumber and CreditCard data attribute type. It can also be loaded by setting MaskedText through RegisterEditor(String, DataFormEditorType).

    Examples

    The below example shows how to create data form masked text editor and how to assign properties to masked text editor.

    • XAML
    • C#
    • C#
    <dataForm:SfDataForm x:Name="dataForm"
            DataObject="{Binding DataModel}">
        <dataForm:SfDataForm.Items>
            <dataForm:DataFormMaskedTextItem
                x:Name="phoneNumber" FieldName="PhoneNumber" PromptChar="*"
                Mask="000-000-0000" MaskType="Simple">
            </dataForm:DataFormMaskedTextItem>
        </dataForm:SfDataForm.Items>
    </dataForm:SfDataForm>
    public class DataModel
    {
        [DataType(DataType.PhoneNumber)]
        public string PhoneNumber { get; set; }
        [DataType(DataType.CreditCard)]
        public string CreditCard { get; set; }
        public string Amount { get; set; }
    }
    this.dataForm.DataObject = new DataModel();
    this.dataForm.RegisterEditor(nameof(DataModel.Amount), DataFormEditorType.MaskedText);
    this.dataForm.GenerateDataFormItem += OnGenerateDataFormItem;
    private void OnGenerateDataFormItem(object sender, GenerateDataFormItemEventArgs e)
    {
        if (e.DataFormItem != null)
        {
            if (e.DataFormItem is DataFormMaskedTextItem amount && e.DataFormItem.FieldName == nameof(DataModel.Amount))
            {
                amount.PromptChar = '_';
                amount.MaskType = MaskedEditorMaskType.Simple;
                amount.Mask = "0,000.00";
                amount.ValueMaskFormat = MaskedEditorMaskFormat.IncludePrompt;
            }
            else if (e.DataFormItem is DataFormMaskedTextItem phoneNumber && e.DataFormItem.FieldName == nameof(DataModel.PhoneNumber))
            {
                phoneNumber.PromptChar = '#';
                phoneNumber.MaskType = MaskedEditorMaskType.Simple;
                phoneNumber.Mask="000 000 0000";
                phoneNumber.ValueMaskFormat = MaskedEditorMaskFormat.IncludePromptAndLiterals;
                phoneNumber.ClearButtonVisibility = MaskedEditorClearButtonVisibility.WhileEditing;
            }
        }
    }

    Constructors

    DataFormMaskedTextItem()

    Initializes a new instance of the DataFormMaskedTextItem class.

    Declaration
    public DataFormMaskedTextItem()

    Fields

    ClearButtonVisibilityProperty

    Identifies the ClearButtonVisibility dependency property.

    Declaration
    public static readonly BindableProperty ClearButtonVisibilityProperty
    Field Value
    Type Description
    Microsoft.Maui.Controls.BindableProperty

    The identifier for ClearButtonVisibility dependency property.

    Remarks

    The ClearButtonVisibility property is applicable only for Windows.

    CultureProperty

    Identifies the Culture dependency property.

    Declaration
    public static readonly BindableProperty CultureProperty
    Field Value
    Type Description
    Microsoft.Maui.Controls.BindableProperty

    The identifier for Culture dependency property.

    MaskProperty

    Identifies the Mask dependency property.

    Declaration
    public static readonly BindableProperty MaskProperty
    Field Value
    Type Description
    Microsoft.Maui.Controls.BindableProperty

    The identifier for Mask dependency property.

    MaskTypeProperty

    Identifies the MaskType dependency property.

    Declaration
    public static readonly BindableProperty MaskTypeProperty
    Field Value
    Type Description
    Microsoft.Maui.Controls.BindableProperty

    The identifier for MaskType dependency property.

    PromptCharProperty

    Identifies the PromptChar dependency property.

    Declaration
    public static readonly BindableProperty PromptCharProperty
    Field Value
    Type Description
    Microsoft.Maui.Controls.BindableProperty

    The identifier for PromptChar dependency property.

    ValueMaskFormatProperty

    Identifies the ValueMaskFormat dependency property.

    Declaration
    public static readonly BindableProperty ValueMaskFormatProperty
    Field Value
    Type Description
    Microsoft.Maui.Controls.BindableProperty

    The identifier for ValueMaskFormat dependency property.

    Properties

    ClearButtonVisibility

    Gets or sets a value indicating when to display a clear button, which enables the user to clear the text.

    Declaration
    public MaskedEditorClearButtonVisibility ClearButtonVisibility { get; set; }
    Property Value
    Type
    MaskedEditorClearButtonVisibility
    Remarks

    The ClearButtonVisibility property is applicable only for Windows.

    Culture

    Gets or sets the culture for mask values based on the given Culture.

    Declaration
    public CultureInfo Culture { get; set; }
    Property Value
    Type Description
    System.Globalization.CultureInfo

    It takes the culture value. The default value is System.Globalization.CultureInfo.CurrentCulture.

    Mask

    Gets or sets the mask value which restricts the inputs provided in the control.

    Declaration
    public string Mask { get; set; }
    Property Value
    Type Description
    System.String

    It takes the string value. The default value is null.

    MaskType

    Gets or sets the mask type for the Syncfusion.Maui.DataForm.DataFormMaskedTextEditor.

    Declaration
    public MaskedEditorMaskType MaskType { get; set; }
    Property Value
    Type Description
    MaskedEditorMaskType

    It takes the mask type value. The default value is Simple.

    PromptChar

    Gets or sets a char which used as a prompt char of Syncfusion.Maui.DataForm.DataFormMaskedTextEditor.

    Declaration
    public char PromptChar { get; set; }
    Property Value
    Type Description
    System.Char

    It takes the char value. The default value is "_".

    ValueMaskFormat

    Gets or sets the format for the value.

    Declaration
    public MaskedEditorMaskFormat ValueMaskFormat { get; set; }
    Property Value
    Type Description
    MaskedEditorMaskFormat

    It takes the mask format for the value. The default value is IncludePromptAndLiterals.

    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved