Class SfTextInputLayout
The text input layout control adds decorative elements such as floating label, icons, and assistive labels on the top of the input views.
Implements
Inherited Members
Namespace: Syncfusion.Maui.Core
Assembly: Syncfusion.Maui.Core.dll
Syntax
public class SfTextInputLayout : SfContentView, IDrawableLayout, IDrawable, IAbsoluteLayout, ILayout, IView, IElement, ITransform, IContainer, IList<IView>, ICollection<IView>, IEnumerable<IView>, IEnumerable, ISafeAreaView, IPadding, ICrossPlatformLayout, IVisualTreeElement, ISemanticsProvider, ITouchListener, IParentThemeElement, IThemeElement
Examples
<inputLayout:SfTextInputLayout Hint="Hint" HelperText="Helper" ErrorText="Error">
<Entry />
</inputLayout:SfTextInputLayout>
Constructors
SfTextInputLayout()
Initializes a new instance of the SfTextInputLayout class.
Declaration
public SfTextInputLayout()
Fields
CharMaxLengthProperty
Gets or sets the length of the maximum character value. When the character count reaches the character maximum length, the error color will be applied.
Declaration
public static readonly BindableProperty CharMaxLengthProperty
Field Value
| Type |
|---|
| Microsoft.Maui.Controls.BindableProperty |
ContainerBackgroundProperty
Gets or sets the background color of the container.
Declaration
public static readonly BindableProperty ContainerBackgroundProperty
Field Value
| Type |
|---|
| Microsoft.Maui.Controls.BindableProperty |
ContainerTypeProperty
Gets or sets a value that determines the appearance of background and its border.
Declaration
public static readonly BindableProperty ContainerTypeProperty
Field Value
| Type |
|---|
| Microsoft.Maui.Controls.BindableProperty |
CurrentActiveColorProperty
Gets a value for current active color based on input view focus state.
Declaration
public static readonly BindableProperty CurrentActiveColorProperty
Field Value
| Type |
|---|
| Microsoft.Maui.Controls.BindableProperty |
EnableFloatingProperty
Gets or sets a value that indicates whether to float the label when it is focused or unfocused.
Declaration
public static readonly BindableProperty EnableFloatingProperty
Field Value
| Type |
|---|
| Microsoft.Maui.Controls.BindableProperty |
EnableHintAnimationProperty
Gets or sets a value that indicates whether to enable animation for the hint text when the input view is focused or unfocused.
Declaration
public static readonly BindableProperty EnableHintAnimationProperty
Field Value
| Type | Description |
|---|---|
| Microsoft.Maui.Controls.BindableProperty |
|
EnablePasswordVisibilityToggleProperty
Gets or sets a value that indicates whether to show the password visibility toggle.
Declaration
public static readonly BindableProperty EnablePasswordVisibilityToggleProperty
Field Value
| Type | Description |
|---|---|
| Microsoft.Maui.Controls.BindableProperty |
|
Remarks
This property supports for Microsoft.Maui.Controls.Entry only.
ErrorLabelStyleProperty
Gets or sets the style for error label.
Declaration
public static readonly BindableProperty ErrorLabelStyleProperty
Field Value
| Type |
|---|
| Microsoft.Maui.Controls.BindableProperty |
ErrorTextProperty
Gets or sets the value for validation error. It will be displayed till entering the correct text in the input view.
Declaration
public static readonly BindableProperty ErrorTextProperty
Field Value
| Type |
|---|
| Microsoft.Maui.Controls.BindableProperty |
FocusedStrokeThicknessProperty
Gets or sets as value to customize the stroke width in focused state, it is applicable for the bottom line and outline border. when setting the container type as filled and outlined respectively.
Declaration
public static readonly BindableProperty FocusedStrokeThicknessProperty
Field Value
| Type |
|---|
| Microsoft.Maui.Controls.BindableProperty |
HasErrorProperty
Gets or sets a value that indicates whether it has validation errors.
Declaration
public static readonly BindableProperty HasErrorProperty
Field Value
| Type | Description |
|---|---|
| Microsoft.Maui.Controls.BindableProperty |
|
HelperLabelStyleProperty
Gets or sets the style for helper label.
Declaration
public static readonly BindableProperty HelperLabelStyleProperty
Field Value
| Type |
|---|
| Microsoft.Maui.Controls.BindableProperty |
HelperTextProperty
Gets or sets a value for helper text in the input view. It conveys the additional information about the text in the input view.
Declaration
public static readonly BindableProperty HelperTextProperty
Field Value
| Type |
|---|
| Microsoft.Maui.Controls.BindableProperty |
HintLabelStyleProperty
Gets or sets the style for hint label.
Declaration
public static readonly BindableProperty HintLabelStyleProperty
Field Value
| Type |
|---|
| Microsoft.Maui.Controls.BindableProperty |
HintProperty
Gets or sets a value for hint text in the input view.
Declaration
public static readonly BindableProperty HintProperty
Field Value
| Type |
|---|
| Microsoft.Maui.Controls.BindableProperty |
InputViewPaddingProperty
Gets or sets desired padding to override default padding for input view.
Declaration
public static readonly BindableProperty InputViewPaddingProperty
Field Value
| Type |
|---|
| Microsoft.Maui.Controls.BindableProperty |
IsEnabledProperty
Gets or sets a value that indicates whether users can interact with the control.
Declaration
public static readonly BindableProperty IsEnabledProperty
Field Value
| Type |
|---|
| Microsoft.Maui.Controls.BindableProperty |
IsHintAlwaysFloatedProperty
Gets or sets a value that indicates whether to fix the hint label always at the top even when the text is empty.
Declaration
public static readonly BindableProperty IsHintAlwaysFloatedProperty
Field Value
| Type |
|---|
| Microsoft.Maui.Controls.BindableProperty |
LeadingViewPositionProperty
Gets or sets the value that determines whether to place the leading view within the layout.
Declaration
public static readonly BindableProperty LeadingViewPositionProperty
Field Value
| Type |
|---|
| Microsoft.Maui.Controls.BindableProperty |
LeadingViewProperty
Gets or sets a value for a view to place before input view.
Declaration
public static readonly BindableProperty LeadingViewProperty
Field Value
| Type |
|---|
| Microsoft.Maui.Controls.BindableProperty |
OutlineCornerRadiusProperty
Gets or sets a value to customize the customize the corner radius of outline border.
Declaration
public static readonly BindableProperty OutlineCornerRadiusProperty
Field Value
| Type |
|---|
| Microsoft.Maui.Controls.BindableProperty |
Remarks
it is applicable only when set the container type as outlined.
ReserveSpaceForAssistiveLabelsProperty
Gets or sets a value indicating whether to allocate space for assistive texts. assistive labels includes helper text, error text and character counter.
Declaration
public static readonly BindableProperty ReserveSpaceForAssistiveLabelsProperty
Field Value
| Type |
|---|
| Microsoft.Maui.Controls.BindableProperty |
Remarks
when this property is set as false, assitive labels will not be shown even they are not enabled.
ShowHelperTextProperty
Gets or sets a value indicating whether to display the helper text and error text. It determines the visibility of the helper text and error text.
Declaration
public static readonly BindableProperty ShowHelperTextProperty
Field Value
| Type | Description |
|---|---|
| Microsoft.Maui.Controls.BindableProperty |
|
ShowHintProperty
Gets or sets a value that indicates whether to display the hint text.
Declaration
public static readonly BindableProperty ShowHintProperty
Field Value
| Type | Description |
|---|---|
| Microsoft.Maui.Controls.BindableProperty |
|
ShowLeadingViewProperty
Gets or sets a value that indicates whether to display the leading view.
Declaration
public static readonly BindableProperty ShowLeadingViewProperty
Field Value
| Type | Description |
|---|---|
| Microsoft.Maui.Controls.BindableProperty |
|
ShowTrailingViewProperty
Gets or sets a value that indicates whether to display the trailing view.
Declaration
public static readonly BindableProperty ShowTrailingViewProperty
Field Value
| Type | Description |
|---|---|
| Microsoft.Maui.Controls.BindableProperty |
|
StrokeProperty
Gets or sets the border color our base line color based on the container.
Declaration
public static readonly BindableProperty StrokeProperty
Field Value
| Type |
|---|
| Microsoft.Maui.Controls.BindableProperty |
TrailingViewPositionProperty
Gets or sets a value that determines whether to place the trailing view within the layout.
Declaration
public static readonly BindableProperty TrailingViewPositionProperty
Field Value
| Type |
|---|
| Microsoft.Maui.Controls.BindableProperty |
TrailingViewProperty
Gets or sets a value for a view to place after input view.
Declaration
public static readonly BindableProperty TrailingViewProperty
Field Value
| Type |
|---|
| Microsoft.Maui.Controls.BindableProperty |
UnfocusedStrokeThicknessProperty
Gets or sets as value to customize the stroke width in unfocused state, it is applicable for the bottom line and outline border when setting the container type as filled and outlined respectively.
Declaration
public static readonly BindableProperty UnfocusedStrokeThicknessProperty
Field Value
| Type |
|---|
| Microsoft.Maui.Controls.BindableProperty |
Properties
CharMaxLength
Gets or sets the length of the maximum character value. When the character count reaches the character maximum length, the error color will be applied.
Declaration
public int CharMaxLength { get; set; }
Property Value
| Type |
|---|
| System.Int32 |
ContainerBackground
Gets or sets the background color of the container.
Declaration
public Brush ContainerBackground { get; set; }
Property Value
| Type |
|---|
| Microsoft.Maui.Controls.Brush |
ContainerType
Gets or sets a value that determines the appearance of background and its border.
Declaration
public ContainerType ContainerType { get; set; }
Property Value
| Type |
|---|
| ContainerType |
CurrentActiveColor
Gets a value for current active color based on input view focus state.
Declaration
public Color CurrentActiveColor { get; }
Property Value
| Type |
|---|
| Microsoft.Maui.Graphics.Color |
EnableFloating
Gets or sets a value indicating whether to float the label when it is focused or unfocused.
Declaration
public bool EnableFloating { get; set; }
Property Value
| Type |
|---|
| System.Boolean |
EnableHintAnimation
Gets or sets a value indicating whether to enable animation for the hint text when the input view is focused or unfocused.
Declaration
public bool EnableHintAnimation { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
|
EnablePasswordVisibilityToggle
Gets or sets a value indicating whether to show the password visibility toggle.
Declaration
public bool EnablePasswordVisibilityToggle { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
|
Remarks
This property supports for Microsoft.Maui.Controls.Entry only.
ErrorLabelStyle
Gets or sets the style for error label.
Declaration
public LabelStyle ErrorLabelStyle { get; set; }
Property Value
| Type |
|---|
| LabelStyle |
ErrorText
Gets or sets the value for validation error. Error messages are displayed below the input line, replacing helper text until fixed.
Declaration
public string ErrorText { get; set; }
Property Value
| Type |
|---|
| System.String |
FocusedStrokeThickness
Gets or sets as value to customize the stroke width in focused state, it is applicable for the bottom line and outline border when setting the container type as filled and outlined respectively.
Declaration
public double FocusedStrokeThickness { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Double | The default value is 2. |
HasError
Gets or sets a value indicating whether it has validation errors. It determines the visibility of the error text.
Declaration
public bool HasError { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
|
HelperLabelStyle
Gets or sets the style for helper label.
Declaration
public LabelStyle HelperLabelStyle { get; set; }
Property Value
| Type |
|---|
| LabelStyle |
HelperText
Gets or sets a value for helper text in the input view. It conveys the additional information about the text in the input view.
Declaration
public string HelperText { get; set; }
Property Value
| Type |
|---|
| System.String |
Hint
Gets or sets a value for hint text in the input view.
Declaration
public string Hint { get; set; }
Property Value
| Type |
|---|
| System.String |
HintLabelStyle
Gets or sets the style for hint label.
Declaration
public LabelStyle HintLabelStyle { get; set; }
Property Value
| Type |
|---|
| LabelStyle |
InputViewPadding
Gets or sets desired padding to override default padding for input view.
Declaration
public Thickness InputViewPadding { get; set; }
Property Value
| Type |
|---|
| Microsoft.Maui.Thickness |
IsEnabled
Gets or sets a value indicating whether users can interact with the control.
Declaration
public bool IsEnabled { get; set; }
Property Value
| Type |
|---|
| System.Boolean |
IsHintAlwaysFloated
Gets or sets a value indicating whether to fix the hint label always at the top even when the text is empty.
Declaration
public bool IsHintAlwaysFloated { get; set; }
Property Value
| Type |
|---|
| System.Boolean |
LeadingView
Gets or sets a value for a view to place before input view.
Declaration
public View LeadingView { get; set; }
Property Value
| Type |
|---|
| Microsoft.Maui.Controls.View |
LeadingViewPosition
Gets or sets the value that determines whether to place the leading view within the layout.
Declaration
public ViewPosition LeadingViewPosition { get; set; }
Property Value
| Type |
|---|
| ViewPosition |
OutlineCornerRadius
Gets or sets a value to customize the corner radius of outline border.
Declaration
public double OutlineCornerRadius { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Double | The default value is 4. |
Remarks
It is applicable only when set the container type as outlined.
ReserveSpaceForAssistiveLabels
Gets or sets a value indicating whether to allocate space for assistive labels. Assistive labels includes helper text, error text and character counter.
Declaration
public bool ReserveSpaceForAssistiveLabels { get; set; }
Property Value
| Type |
|---|
| System.Boolean |
Remarks
When this property is set as false, space will be allocated based on the values of helper text, error text and character count labels.
ShowHelperText
Gets or sets a value indicating whether to display the helper text and error text. It determines the visibility of the helper text and error text.
Declaration
public bool ShowHelperText { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
|
ShowHint
Gets or sets a value indicating whether to display the hint text.
Declaration
public bool ShowHint { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
|
ShowLeadingView
Gets or sets a value indicating whether to show or hide the leading view.
Declaration
public bool ShowLeadingView { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
|
ShowTrailingView
Gets or sets a value indicating whether to show or hide the trailing view.
Declaration
public bool ShowTrailingView { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
|
Stroke
Gets or sets the border color or base line color based on container.
Declaration
public Color Stroke { get; set; }
Property Value
| Type |
|---|
| Microsoft.Maui.Graphics.Color |
Text
Gets the value of input text of the text input layout.
Declaration
public string Text { get; }
Property Value
| Type |
|---|
| System.String |
TrailingView
Gets or sets a value for a view to place after input view.
Declaration
public View TrailingView { get; set; }
Property Value
| Type |
|---|
| Microsoft.Maui.Controls.View |
TrailingViewPosition
Gets or sets a value that determines whether to place the trailing view within the layout.
Declaration
public ViewPosition TrailingViewPosition { get; set; }
Property Value
| Type |
|---|
| ViewPosition |
UnfocusedStrokeThickness
Gets or sets as value to customize the stroke width in unfocused state, it is applicable for the bottom line and outline border when setting the container type as filled and outlined respectively.
Declaration
public double UnfocusedStrokeThickness { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Double | The default value is 1. |
Methods
ArrangeContent(Rect)
Declaration
protected override Size ArrangeContent(Rect bounds)
Parameters
| Type | Name | Description |
|---|---|---|
| Microsoft.Maui.Graphics.Rect | bounds |
Returns
| Type |
|---|
| Microsoft.Maui.Graphics.Size |
Overrides
ChangeVisualState()
Declaration
protected override void ChangeVisualState()
Finalize()
Destructor of the SfTextInputLayout class
Declaration
protected override void Finalize()
Focus()
This method set focus to the control.
Declaration
public void Focus()
MeasureContent(Double, Double)
Declaration
protected override Size MeasureContent(double widthConstraint, double heightConstraint)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Double | widthConstraint | |
| System.Double | heightConstraint |
Returns
| Type |
|---|
| Microsoft.Maui.Graphics.Size |
Overrides
OnContentChanged(Object, Object)
Declaration
protected override void OnContentChanged(object oldValue, object newValue)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Object | oldValue | |
| System.Object | newValue |
Overrides
OnDraw(ICanvas, RectF)
Declaration
protected override void OnDraw(ICanvas canvas, RectF dirtyRect)
Parameters
| Type | Name | Description |
|---|---|---|
| Microsoft.Maui.Graphics.ICanvas | canvas | |
| Microsoft.Maui.Graphics.RectF | dirtyRect |
Overrides
OnHandlerChanged()
Declaration
protected override void OnHandlerChanged()
Overrides
OnHandlerChanging(HandlerChangingEventArgs)
Declaration
protected override void OnHandlerChanging(HandlerChangingEventArgs args)
Parameters
| Type | Name | Description |
|---|---|---|
| Microsoft.Maui.Controls.HandlerChangingEventArgs | args |
OnSizeAllocated(Double, Double)
Declaration
protected override void OnSizeAllocated(double width, double height)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Double | width | |
| System.Double | height |
Unfocus()
This method set unfocus to the control.
Declaration
public void Unfocus()
Events
PasswordVisibilityToggled
The PasswordVisibilityToggled event occurs when the visibility of the password input is toggled.
Declaration
public event EventHandler<PasswordVisibilityToggledEventArgs> PasswordVisibilityToggled
Event Type
| Type |
|---|
| System.EventHandler<PasswordVisibilityToggledEventArgs> |