Class SfMaskedEntry
The SfMaskedEntry control is an enhanced version of a text box that additionally restricts input to conform to a specific structure or mask.
Implements
Inherited Members
Namespace: Syncfusion.Maui.Inputs
Assembly: Syncfusion.Maui.Inputs.dll
Syntax
public class SfMaskedEntry : SfView, IDrawableLayout, IDrawable, IAbsoluteLayout, ILayout, IView, IElement, ITransform, IContainer, IList<IView>, ICollection<IView>, IEnumerable<IView>, IEnumerable, ISafeAreaView, IPadding, ICrossPlatformLayout, IVisualTreeElement, ISemanticsProvider, ITextElement, ITouchListener, IKeyboardListener, IParentThemeElement, IThemeElement, ITextInputLayout
Examples
This example illustrates how to set email mask value using regex mask.
<syncfusion:SfMaskedEntry MaskType="RegEx" Mask="[A-Za-z0-9-.%]+@[A-Za-z0-9]+.[A-Za-z]{3}"/>
SfMaskedEntry maskedEntry = new SfMaskedEntry();
maskedEntry.MaskType = MaskedEntryMaskType.RegEx;
maskedEntry.Mask = "[A-Za-z0-9-.%]+@[A-Za-z0-9]+.[A-Za-z]{3}";
Constructors
SfMaskedEntry()
Initializes the new instance of the class.
Declaration
public SfMaskedEntry()
Fields
ClearButtonColorProperty
Identifies ClearButtonColor bindable property.
Declaration
public static readonly BindableProperty ClearButtonColorProperty
Field Value
Type | Description |
---|---|
Microsoft.Maui.Controls.BindableProperty | The identifier for the ClearButtonColor bindable property. |
ClearButtonPathProperty
Identifies the ClearButtonPath bindable property. This property can be used to customize the clear button of MaskedEntry Control.
Declaration
public static readonly BindableProperty ClearButtonPathProperty
Field Value
Type | Description |
---|---|
Microsoft.Maui.Controls.BindableProperty | The identifier for the ClearButtonPath bindable property. |
ClearButtonVisibilityProperty
Identifies the ClearButtonVisibility property. It indicates whether displays a clear button, which enables the user to clear the text.
Declaration
public static readonly BindableProperty ClearButtonVisibilityProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
CultureProperty
Identifies the Culture dependency property.
Declaration
public static readonly BindableProperty CultureProperty
Field Value
Type | Description |
---|---|
Microsoft.Maui.Controls.BindableProperty | The identifier for the Culture dependency property. |
CursorPositionProperty
Identifies the CursorPosition property. It indicates the cursor position of the SfMaskedEntry.
Declaration
public static readonly BindableProperty CursorPositionProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
FontAttributesProperty
Identifies the FontAttributes bindable property.
Declaration
public static readonly BindableProperty FontAttributesProperty
Field Value
Type | Description |
---|---|
Microsoft.Maui.Controls.BindableProperty | The identifier for FontAttributes bindable property. |
FontAutoScalingEnabledProperty
Identifies the FontAutoScalingEnabled bindable property.
Declaration
public static readonly BindableProperty FontAutoScalingEnabledProperty
Field Value
Type | Description |
---|---|
Microsoft.Maui.Controls.BindableProperty | The identifier for FontAutoScalingEnabled bindable property. |
FontFamilyProperty
Identifies the FontFamily bindable property.
Declaration
public static readonly BindableProperty FontFamilyProperty
Field Value
Type | Description |
---|---|
Microsoft.Maui.Controls.BindableProperty | The identifier for FontFamily bindable property. |
FontSizeProperty
Identifies the FontSize bindable property.
Declaration
public static readonly BindableProperty FontSizeProperty
Field Value
Type | Description |
---|---|
Microsoft.Maui.Controls.BindableProperty | The identifier for FontSize bindable property. |
HidePromptOnLeaveProperty
Identifies the HidePromptOnLeave dependency property.
Declaration
public static readonly BindableProperty HidePromptOnLeaveProperty
Field Value
Type | Description |
---|---|
Microsoft.Maui.Controls.BindableProperty | The identifier for the HidePromptOnLeave dependency property. |
HorizontalTextAlignmentProperty
Gets or sets the value of HorizontalTextAlignment. This property can be used to give HorizontalTextAlignment to the Text in MaskedEntry control.This is Bindable Property.
Declaration
public static readonly BindableProperty HorizontalTextAlignmentProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
KeyboardProperty
Identifies the Keyboard property. The value of the Keyboard for the SfMaskedEntry control.
Declaration
public static readonly BindableProperty KeyboardProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
MaskProperty
Identifies the Mask dependency property.
Declaration
public static readonly BindableProperty MaskProperty
Field Value
Type | Description |
---|---|
Microsoft.Maui.Controls.BindableProperty | The identifier for the 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 the MaskType dependency property. |
PasswordCharProperty
Identifies the PromptChar dependency property.
Declaration
public static readonly BindableProperty PasswordCharProperty
Field Value
Type | Description |
---|---|
Microsoft.Maui.Controls.BindableProperty | The identifier for the PasswordChar dependency property. |
PlaceholderColorProperty
Identifies the PlaceholderColor property. It's the color of the Placeholder text when the SfMaskedEntry value is null or empty.
Declaration
public static readonly BindableProperty PlaceholderColorProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
PlaceholderProperty
Identifies the Placeholder property. Placeholder text is shown when the SfMaskedEntry value is null or empty.
Declaration
public static readonly BindableProperty PlaceholderProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
PromptCharProperty
Identifies the PromptChar dependency property.
Declaration
public static readonly BindableProperty PromptCharProperty
Field Value
Type | Description |
---|---|
Microsoft.Maui.Controls.BindableProperty | The identifier for the PromptChar dependency property. |
ReturnCommandParameterProperty
Identifies the ReturnCommandParameter bindable property. ReturnCommandParameter is a type of object and it specifies the parameter for the ReturnCommand.
Declaration
public static readonly BindableProperty ReturnCommandParameterProperty
Field Value
Type | Description |
---|---|
Microsoft.Maui.Controls.BindableProperty | The identifier for the ReturnCommandParameter bindable property. |
ReturnCommandProperty
Identifies the ReturnCommand bindable property.The return command will trigger whenever the return key is pressed. The default value is null.
Declaration
public static readonly BindableProperty ReturnCommandProperty
Field Value
Type | Description |
---|---|
Microsoft.Maui.Controls.BindableProperty | The identifier for the ReturnCommand bindable property. |
ReturnTypeProperty
Identifies the ReturnType bindable property. This property can be used to change the ReturnType.
Declaration
public static readonly BindableProperty ReturnTypeProperty
Field Value
Type | Description |
---|---|
Microsoft.Maui.Controls.BindableProperty | The identifier for the ReturnType bindable property. |
ShowBorderProperty
Identifies ShowBorder dependency property.
Declaration
public static readonly BindableProperty ShowBorderProperty
Field Value
Type | Description |
---|---|
Microsoft.Maui.Controls.BindableProperty | The identifier for the ShowBorder dependency property. |
StrokeProperty
Identifies Stroke bindable property.
Declaration
public static readonly BindableProperty StrokeProperty
Field Value
Type | Description |
---|---|
Microsoft.Maui.Controls.BindableProperty | The identifier for the Stroke bindable property. |
TextColorProperty
Identifies the TextColor bindable property.
Declaration
public static readonly BindableProperty TextColorProperty
Field Value
Type | Description |
---|---|
Microsoft.Maui.Controls.BindableProperty | The identifier for TextColor bindable property. |
TextProperty
Identifies the Text dependency property.
Declaration
public static readonly BindableProperty TextProperty
Field Value
Type | Description |
---|---|
Microsoft.Maui.Controls.BindableProperty | The identifier for the Text dependency property. |
ValidationModeProperty
Identifies the ValidationMode dependency property.
Declaration
public static readonly BindableProperty ValidationModeProperty
Field Value
Type | Description |
---|---|
Microsoft.Maui.Controls.BindableProperty | The identifier for the ValidationMode 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 the ValueMaskFormat dependency property. |
ValueProperty
Identifies the Value dependency property.
Declaration
public static readonly BindableProperty ValueProperty
Field Value
Type | Description |
---|---|
Microsoft.Maui.Controls.BindableProperty | The identifier for the Value dependency property. |
VerticalTextAlignmentProperty
Gets or sets the value of VerticalTextAlignment. This property can be used to give VerticalTextAlignment to the Text in MaskedEntry control.This is Bindable Property.
Declaration
public static readonly BindableProperty VerticalTextAlignmentProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
Properties
ClearButtonColor
Gets or sets a color that describes the color of clear button of SfMaskedEntry control..
Declaration
public Color ClearButtonColor { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.Maui.Graphics.Color | Specifies the value for clear button. The default value is Colors.Black. |
ClearButtonPath
Gets or sets the path to customize the appearance of the clear button in the MaskedEntry control.
Declaration
public Path ClearButtonPath { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.Maui.Controls.Shapes.Path | Specifies the ClearButtonPath. The default value is null |
ClearButtonVisibility
Gets or sets a value indicating whether displays a clear button, which enables the user to clear the text.
Declaration
public ClearButtonVisibility ClearButtonVisibility { get; set; }
Property Value
Type |
---|
Microsoft.Maui.ClearButtonVisibility |
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. |
CursorPosition
Gets or sets the position of the cursor in SfMaskedEntry
Declaration
public int CursorPosition { get; set; }
Property Value
Type |
---|
System.Int32 |
Font
Gets or sets the font for the text of SfMaskedEntry.
Declaration
public Font Font { get; }
Property Value
Type |
---|
Microsoft.Maui.Font |
FontAttributes
Gets or sets the value that indicates whether the font for the MaskedEntry text is bold,italic, or neither.
Declaration
public FontAttributes FontAttributes { get; set; }
Property Value
Type |
---|
Microsoft.Maui.Controls.FontAttributes |
FontAutoScalingEnabled
Enables automatic font size adjustment based on device settings.
Declaration
public bool FontAutoScalingEnabled { get; set; }
Property Value
Type |
---|
System.Boolean |
FontFamily
Gets or sets the font family for the text of SfMaskedEntry.
Declaration
public string FontFamily { get; set; }
Property Value
Type |
---|
System.String |
FontSize
Gets or sets the value of FontSize. This property can be used to the size of the font for SfMaskedEntry.
Declaration
public double FontSize { get; set; }
Property Value
Type |
---|
System.Double |
HasError
Gets a value indicating whether the mask is succeeded or not.
Declaration
public bool HasError { get; }
Property Value
Type |
---|
System.Boolean |
HidePromptOnLeave
Gets or sets a value indicating whether the prompt characters in the input mask are hidden when the masked entry loses focus.
Declaration
public bool HidePromptOnLeave { get; set; }
Property Value
Type |
---|
System.Boolean |
HorizontalTextAlignment
Gets or sets a value to change the horizontal alignment of text within the MaskedEntry control.
Declaration
public TextAlignment HorizontalTextAlignment { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.Maui.TextAlignment | Specifies the text alignment.The default value is Microsoft.Maui.TextAlignment.Start. |
Keyboard
Gets or sets the value of the Keyboard for the SfMaskedEntry control.
Declaration
public Keyboard Keyboard { get; set; }
Property Value
Type |
---|
Microsoft.Maui.Keyboard |
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 SfMaskedEntry control.
Declaration
public MaskedEntryMaskType MaskType { get; set; }
Property Value
Type | Description |
---|---|
MaskedEntryMaskType | It takes the mask type value. The default value is Simple. |
Examples
<syncfusion:SfMaskedEntry MaskType="RegEx" Mask="[A-Za-z0-9-.%]+@[A-Za-z0-9]+.[A-Za-z]{3}"/>
PasswordChar
Gets or sets a value to be displayed in substitute of user input for the of SfMaskedEntry control.
Declaration
public char PasswordChar { get; set; }
Property Value
Type | Description |
---|---|
System.Char | It takes the char value. The default value is '/0'. |
Placeholder
Gets or sets the text of the Placeholder when the SfMaskedEntry value is null or empty.
Declaration
public string Placeholder { get; set; }
Property Value
Type |
---|
System.String |
PlaceholderColor
Gets or sets the color of the Placeholder text when the SfMaskedEntry value is null or empty.
Declaration
public Color PlaceholderColor { get; set; }
Property Value
Type |
---|
Microsoft.Maui.Graphics.Color |
PromptChar
Gets or sets a char which used as a prompt char of SfMaskedEntry.
Declaration
public char PromptChar { get; set; }
Property Value
Type | Description |
---|---|
System.Char | It takes the char value. The default value is "_". |
ReturnCommand
Gets or sets the Returncommand to run when the user presses the return key, either physically or on the on-screen keyboard.
Declaration
public ICommand ReturnCommand { get; set; }
Property Value
Type | Description |
---|---|
System.Windows.Input.ICommand | Specifies the Returncommand. The default value is null. |
ReturnCommandParameter
Gets or sets the parameter object for the ReturnCommand that can be used to provide extra information.
Declaration
public object ReturnCommandParameter { get; set; }
Property Value
Type | Description |
---|---|
System.Object | Specifies the ReturncommandParameter. The default value in null |
ReturnType
Gets or sets the value of ReturnType. This property can be used to set the ReturnType.
Declaration
public ReturnType ReturnType { get; set; }
Property Value
Type |
---|
Microsoft.Maui.ReturnType |
ShowBorder
Gets or sets a value indicating whether to show or hide the border of the SfMaskedEntry control.
Declaration
public bool ShowBorder { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | The default value is true. |
Stroke
Gets or sets a color to customize the stroke appearance in the SfMaskedEntry control.
Declaration
public Brush Stroke { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.Maui.Controls.Brush | Specifies the color value for stroke. The default value is Colors.LightGray. |
Text
Gets the displayed text of the SfMaskedEntry control.
Declaration
public string Text { get; }
Property Value
Type | Description |
---|---|
System.String | It takes the string value. The default value is empty. |
TextColor
Gets or sets the color for the text of the SfMaskedEntry control.
Declaration
public Color TextColor { get; set; }
Property Value
Type |
---|
Microsoft.Maui.Graphics.Color |
ValidationMode
Gets or sets the input validation mode for the SfMaskedEntry control.
Declaration
public InputValidationMode ValidationMode { get; set; }
Property Value
Type | Description |
---|---|
InputValidationMode | It takes the validation mode value. The default value is LostFocus. |
Value
Gets or sets the input value for SfMaskedEntry control.
Declaration
public object Value { get; set; }
Property Value
Type | Description |
---|---|
System.Object | It takes the value of masked entry. The default value is null. |
Examples
<syncfusion:SfMaskedEntry MaskType="Simple" Mask="00/00/0000" Value="12"/>
ValueMaskFormat
Gets or sets the format for the value.
Declaration
public MaskedEntryMaskFormat ValueMaskFormat { get; set; }
Property Value
Type | Description |
---|---|
MaskedEntryMaskFormat | It takes the mask format for the value. The default value is IncludePromptAndLiterals. |
Examples
<syncfusion:SfMaskedEntry x:Name="maskedEntry" Mask="00/00/0000" Value="12" ValueMaskFormat="ExcludePromptAndLiterals"/>
VerticalTextAlignment
Gets or sets a value to change the vertical alignment of text within the MaskedEntry control.
Declaration
public TextAlignment VerticalTextAlignment { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.Maui.TextAlignment | Specifies the text alignment.The default value is Microsoft.Maui.TextAlignment.Center. |
Methods
ArrangeContent(Rect)
Arrange content method.
Declaration
protected override Size ArrangeContent(Rect bounds)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.Maui.Graphics.Rect | bounds | The bounds. |
Returns
Type | Description |
---|---|
Microsoft.Maui.Graphics.Size | The size. |
Overrides
ChangeVisualState()
Declaration
protected override void ChangeVisualState()
Focus()
This method set focus to the control.
Declaration
public void Focus()
OnDraw(ICanvas, RectF)
Draw method.
Declaration
protected override void OnDraw(ICanvas canvas, RectF dirtyRect)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.Maui.Graphics.ICanvas | canvas | |
Microsoft.Maui.Graphics.RectF | dirtyRect |
Overrides
OnFontChanged(Font, Font)
This method hooked whenever the font changed.
Declaration
public void OnFontChanged(Font oldValue, Font newValue)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.Maui.Font | oldValue | oldValue. |
Microsoft.Maui.Font | newValue | newValue. |
OnParentSet()
Initialize the Parent element
Declaration
protected override void OnParentSet()
Unfocus()
This method set unfocus to the control.
Declaration
public void Unfocus()
Events
ValueChanged
Invoke the event when the Value property is changed.
Declaration
public event EventHandler<MaskedEntryValueChangedEventArgs> ValueChanged
Event Type
Type |
---|
System.EventHandler<MaskedEntryValueChangedEventArgs> |
ValueChanging
Occurs when the value of the control is about to change.
Declaration
public event EventHandler<MaskedEntryValueChangingEventArgs> ValueChanging
Event Type
Type |
---|
System.EventHandler<MaskedEntryValueChangingEventArgs> |
Remarks
The ValueChanging event is raised when the value of the control is about to change. It provides an opportunity to perform additional actions or validation before the value is actually updated.