Events in .NET MAUI Text Input Layout (SfTextInputLayout)
28 Jul 20263 minutes to read
.NET MAUI Text Input Layout raises events to notify your application when the user interacts with the control. This page documents the events exposed directly by Text Input Layout. For events on the inner input view (such as TextChanged, Focused, and Unfocused), refer to the .NET MAUI Entry documentation.
Prerequisites
Before using the SfTextInputLayout, ensure the following NuGet package is installed in your .NET MAUI project:
Syncfusion.Maui.Core
For a step-by-step setup, refer to the Getting Started documentation.
Supported Events
| Event | Trigger | EventArgs |
|---|---|---|
| PasswordVisibilityToggled | Raised when the user taps the password visibility toggle icon. | PasswordVisibilityToggledEventArgs |
NOTE
The
PasswordVisibilityToggledevent fires only when EnablePasswordVisibilityToggle istrue. If the toggle is disabled, the icon is not rendered and the event is never raised.
Password visibility toggled event
The PasswordVisibilityToggled event fires when the user taps the password visibility toggle icon.
Event Arguments
| Property | Type | Description |
|---|---|---|
| IsPasswordVisible | bool |
true when the password is currently visible (shown in plain text); false when the password is hidden. The event fires after the visibility state has changed, so the value reflects the new state. |
<VerticalStackLayout>
<inputLayout:SfTextInputLayout Hint="Password"
EnablePasswordVisibilityToggle="True"
PasswordVisibilityToggled="OnPasswordVisibilityToggled">
<Entry />
</inputLayout:SfTextInputLayout>
</VerticalStackLayout>var inputLayout = new SfTextInputLayout
{
Hint = "Password",
EnablePasswordVisibilityToggle = true,
Content = new Entry { IsPassword = true }
};
Content = new VerticalStackLayout
{
Children =
{
inputLayout
}
};
inputLayout.PasswordVisibilityToggled += OnPasswordVisibilityToggled;The PasswordVisibilityToggled event can be handled in C# as follows:
void OnPasswordVisibilityToggled(object? sender, PasswordVisibilityToggledEventArgs e)
{
bool isPasswordVisible = e.IsPasswordVisible;
if (sender is SfTextInputLayout layout)
{
layout.ShowHint = !isPasswordVisible;
}
}