.NET MAUI Entry Events
The Telerik UI for .NET MAUI Entry control exposes a number of events and commands for notifying after user interactions.
The Entry supports the following events:
-
TextChanged
—Occurs when the text is changed. TheTextChanged
event handler receives aTextChangedEventArgs
argument containing data related to this event. TheTextChangedEventArgs
provides the following properties:-
NewTextValue(string)
—Gets the new text value. -
OldTextValue(string)
—Gets the old text value.
-
-
TextChanging
—Occurs when the text in the Entry starts to change, but before theText
property is updated. TheTextChanging
event handler receives aTextChangingEventArgs
argument containing data related to this event. TheTextChangedEventArgs
provides the following properties:-
NewText
(string
)—Gets the new text that is about to be entered into the entry. -
OldText
(string
)—Gets the old text that is entered into the entry. -
Cancel
(bool
)—Gets or sets a value that indicates whether to cancel the text changes.
-
Completed
—Occurs when the user finalizes the text in an entry with the return key.
The following example demonstrates the Entry definition in XAML with the TextChanged
and Completed
event handlers.
1. Define the Entry.
<VerticalStackLayout>
<telerik:RadEntry x:Name="entry"
Keyboard="Numeric"
WatermarkText="Watermark Text"
TextChanged="Entry_TextChanged"
Completed="Entry_Completed"/>
<Label x:Name="textChangedLabel"/>
</VerticalStackLayout>
TexhChanged
event.
private void Entry_TextChanged(object sender, TextChangedEventArgs e)
{
this.textChangedLabel.Text = $"Text changed from {e.OldTextValue} to {e.NewTextValue}";
}
3. Set the Completed
event.
private void Entry_Completed(object sender, EventArgs e)
{
this.textChangedLabel.Text = "User completed entering text";
}