Class SfMaskedTextBox
The MaskedTextBox is an input element that allows to get input from the user.
Inheritance
System.Object
Syncfusion.Blazor.SfBaseComponent
SfMaskedTextBox
Assembly: Syncfusion.Blazor.dll
Syntax
public class SfMaskedTextBox : SfBaseComponent, IInputBase
Constructors
SfMaskedTextBox()
Declaration
Properties
Blur
Triggers when the SfMaskedTextBox has focus-out.
Declaration
public EventCallback<MaskBlurEventArgs> Blur { get; set; }
Property Value
Created
Triggers when the SfMaskedTextBox component is created.
Declaration
public EventCallback<object> Created { get; set; }
Property Value
Type |
Description |
Microsoft.AspNetCore.Components.EventCallback<System.Object> |
|
CssClass
Specifies the CSS class name that can be appended with the root element of the SfMaskedTextBox. One or more custom CSS classes can be added to a SfMaskedTextBox.
Declaration
public string CssClass { get; set; }
Property Value
Type |
Description |
System.String |
|
CustomCharacters
Sets the collection of values to be mapped for non-mask elements(literals)
which have been set in the mask of MaskedTextBox.
In the below example, non-mask elements "P" accepts values
"P" , "A" , "p" , "a" and "M" accepts values "M", "m" mentioned in the custom characters collection.
Declaration
public Dictionary<string, string> CustomCharacters { get; set; }
Property Value
Type |
Description |
System.Collections.Generic.Dictionary<System.String, System.String> |
|
Destroyed
Triggers when the SfMaskedTextBox component is destroyed.
Declaration
public EventCallback<object> Destroyed { get; set; }
Property Value
Type |
Description |
Microsoft.AspNetCore.Components.EventCallback<System.Object> |
|
Enabled
Specifies a boolean value that indicates whether the SfMaskedTextBox allows the user to interact with it.
Declaration
public bool Enabled { get; set; }
Property Value
Type |
Description |
System.Boolean |
|
EnablePersistence
Enable or disable the persisting SfMaskedTextBox state between page reloads. If enabled, the Value
state will be persisted.
Declaration
public bool EnablePersistence { get; set; }
Property Value
Type |
Description |
System.Boolean |
|
EnableRtl
Enable or disable rendering component in the right to left direction.
Declaration
public bool EnableRtl { get; set; }
Property Value
Type |
Description |
System.Boolean |
|
FloatLabelType
Specifies the floating label behavior of the SfMaskedTextBox that the placeholder text floats above the SfMaskedTextBox based on the following values.
Possible values are:
- NeverNever floats the label in the SfMaskedTextBox when the placeholder is available.
- AlwaysThe floating label always floats above the SfMaskedTextBox.
- AutoThe floating label floats above the SfMaskedTextBox after focusing it or when enters the value in it.
Declaration
public FloatLabelType FloatLabelType { get; set; }
Property Value
Focus
Triggers when the SfMaskedTextBox gets focus.
Declaration
public EventCallback<MaskFocusEventArgs> Focus { get; set; }
Property Value
HtmlAttributes
You can add the additional html attributes such as styles, class, and more to the root element.
If you configured both property and equivalent html attributes, then the component considers the property value.
Declaration
public Dictionary<string, object> HtmlAttributes { get; set; }
Property Value
Type |
Description |
System.Collections.Generic.Dictionary<System.String, System.Object> |
|
ID
Specifies the id of the SfMaskedTextBox component.
Declaration
public string ID { get; set; }
Property Value
Type |
Description |
System.String |
|
InputAttributes
You can add the additional input attributes such as disabled, value, and more to the root element.
If you configured both property and equivalent input attribute, then the component considers the property value.
Declaration
public Dictionary<string, object> InputAttributes { get; set; }
Property Value
Type |
Description |
System.Collections.Generic.Dictionary<System.String, System.Object> |
|
Locale
Specifies the global culture and localization of the SfMaskedTextBox component.
Declaration
public string Locale { get; set; }
Property Value
Type |
Description |
System.String |
|
Mask
Sets a value that masks the MaskedTextBox to allow/validate the user input.
Declaration
public string Mask { get; set; }
Property Value
Type |
Description |
System.String |
|
MaskedTextBoxParent
Declaration
protected dynamic MaskedTextBoxParent { get; set; }
Property Value
Type |
Description |
System.Object |
|
Placeholder
Specifies the text that is shown as a hint or placeholder until the user focuses or enter a value in SfMaskedTextBox. The property is depending on the FloatLabelType property.
Declaration
public string Placeholder { get; set; }
Property Value
Type |
Description |
System.String |
|
PromptChar
Gets or sets a value that will be shown as a prompting symbol for the masked value.
The symbol used to show input positions in the MaskedTextBox.
Declaration
public char PromptChar { get; set; }
Property Value
Type |
Description |
System.Char |
|
Readonly
Specifies the boolean value whether the SfMaskedTextBox allows user to change the text.
Declaration
public bool Readonly { get; set; }
Property Value
Type |
Description |
System.Boolean |
|
SfMaskedTextBoxEditContext
Declaration
protected EditContext SfMaskedTextBoxEditContext { get; set; }
Property Value
Type |
Description |
Microsoft.AspNetCore.Components.Forms.EditContext |
|
ShowClearButton
Specifies a boolean value that indicates whether the clear button is displayed in SfMaskedTextBox.
Declaration
public bool ShowClearButton { get; set; }
Property Value
Type |
Description |
System.Boolean |
|
TabIndex
Specifies the tab order of the SfMaskedTextBox component.
Declaration
public int TabIndex { get; set; }
Property Value
Type |
Description |
System.Int32 |
|
Value
Sets the content of the SfMaskedTextBox.
Declaration
public string Value { get; set; }
Property Value
Type |
Description |
System.String |
|
ValueChange
Triggers when the content of SfMaskedTextBox has changed and gets focus-out.
Declaration
public EventCallback<MaskChangeEventArgs> ValueChange { get; set; }
Property Value
ValueChanged
Specifies the callback to trigger when the value changes.
Declaration
public EventCallback<string> ValueChanged { get; set; }
Property Value
Type |
Description |
Microsoft.AspNetCore.Components.EventCallback<System.String> |
|
Width
Specifies the width of the SfMaskedTextBox component.
Declaration
public string Width { get; set; }
Property Value
Type |
Description |
System.String |
|
Methods
BuildRenderTree(RenderTreeBuilder)
Declaration
protected override void BuildRenderTree(RenderTreeBuilder __builder)
Parameters
Type |
Name |
Description |
Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder |
__builder |
|
FocusIn()
Sets the focus to SfMaskedTextBox component for interaction.
Declaration
Returns
Type |
Description |
System.Threading.Tasks.Task |
|
FocusOut()
Remove the focus from SfMaskedTextBox component, if the component is in focus state.
Declaration
Returns
Type |
Description |
System.Threading.Tasks.Task |
|
GetMaskedValue()
Returns the value of MaskedTextBox with respective mask.
Declaration
public string GetMaskedValue()
Returns
Type |
Description |
System.String |
|
GetPersistData()
Gets the properties to be maintained in the persisted state.
Declaration
public Task<string> GetPersistData()
Returns
Type |
Description |
System.Threading.Tasks.Task<System.String> |
|
OnAfterRenderAsync(Boolean)
Declaration
protected override Task OnAfterRenderAsync(bool firstRender)
Parameters
Type |
Name |
Description |
System.Boolean |
firstRender |
|
Returns
Type |
Description |
System.Threading.Tasks.Task |
|
Overrides
Syncfusion.Blazor.SfBaseComponent.OnAfterRenderAsync(System.Boolean)
OnInitializedAsync()
Declaration
protected override Task OnInitializedAsync()
Returns
Type |
Description |
System.Threading.Tasks.Task |
|
Overrides
Syncfusion.Blazor.SfBaseComponent.OnInitializedAsync()
Declaration
protected override Task OnParametersSetAsync()
Returns
Type |
Description |
System.Threading.Tasks.Task |
|