using Avalonia.Input; using Avalonia.Interactivity; namespace Avalonia.Xaml.Interactions.Events; /// /// /// public abstract class TextInputEventBehavior : InteractiveBehaviorBase { static TextInputEventBehavior() { RoutingStrategiesProperty.OverrideMetadata( new StyledPropertyMetadata( defaultValue: RoutingStrategies.Tunnel | RoutingStrategies.Bubble)); } /// protected override void OnAttachedToVisualTree() { AssociatedObject?.AddHandler(InputElement.TextInputEvent, TextInput, RoutingStrategies); } /// protected override void OnDetachedFromVisualTree() { AssociatedObject?.RemoveHandler(InputElement.TextInputEvent, TextInput); } private void TextInput(object? sender, TextInputEventArgs e) { OnTextInput(sender, e); } /// /// /// /// /// protected virtual void OnTextInput(object? sender, TextInputEventArgs e) { } }