diff --git a/src/Avalonia.Controls/AutoCompleteBox.cs b/src/Avalonia.Controls/AutoCompleteBox.cs
index 8a8c4ead86..3cf7a56c58 100644
--- a/src/Avalonia.Controls/AutoCompleteBox.cs
+++ b/src/Avalonia.Controls/AutoCompleteBox.cs
@@ -610,6 +610,13 @@ namespace Avalonia.Controls
o => o.AsyncPopulator,
(o, v) => o.AsyncPopulator = v);
+ ///
+ /// Defines the event.
+ ///
+ public static readonly RoutedEvent TextChangedEvent =
+ RoutedEvent.Register(
+ nameof(TextChanged), RoutingStrategies.Bubble);
+
private static bool IsValidMinimumPrefixLength(int value) => value >= -1;
private static bool IsValidMinimumPopulateDelay(TimeSpan value) => value.TotalMilliseconds >= 0.0;
@@ -1529,10 +1536,14 @@ namespace Avalonia.Controls
}
///
- /// Occurs when the text in the text box portion of the
- /// changes.
+ /// Occurs asynchronously when the text in the portion of the
+ /// changes.
///
- public event EventHandler? TextChanged;
+ public event EventHandler? TextChanged
+ {
+ add => AddHandler(TextChangedEvent, value);
+ remove => RemoveHandler(TextChangedEvent, value);
+ }
///
/// Occurs when the
@@ -1690,15 +1701,12 @@ namespace Avalonia.Controls
}
///
- /// Raises the
- ///
- /// event.
+ /// Raises the event.
///
- /// A
- /// that contains the event data.
- protected virtual void OnTextChanged(RoutedEventArgs e)
+ /// A that contains the event data.
+ protected virtual void OnTextChanged(TextChangedEventArgs e)
{
- TextChanged?.Invoke(this, e);
+ RaiseEvent(e);
}
///
@@ -1985,7 +1993,7 @@ namespace Avalonia.Controls
if (callTextChanged)
{
- OnTextChanged(new RoutedEventArgs());
+ OnTextChanged(new TextChangedEventArgs(TextChangedEvent));
}
}