diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/RichTextBox.cs b/src/System.Windows.Forms/src/System/Windows/Forms/RichTextBox.cs index 7ba1bb29759..1be3d2b5555 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/RichTextBox.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/RichTextBox.cs @@ -578,6 +578,11 @@ private bool ProtectedError set { richTextBoxFlags[protectedErrorSection] = value ? 1 : 0; } } + private protected override void RaiseAccessibilityTextChangedEvent() + { + // Do not do anything because Win32 provides unmanaged Text pattern for RichTextBox + } + /// /// Returns the name of the action that will be performed if the user /// Redo's their last Undone operation. If no operation can be redone, diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/TextBoxBase.cs b/src/System.Windows.Forms/src/System/Windows/Forms/TextBoxBase.cs index 0fdddba4e5e..14510d95cb5 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/TextBoxBase.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/TextBoxBase.cs @@ -1,4 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. @@ -1608,8 +1608,16 @@ protected override void OnTextChanged(EventArgs e) // the text changes. CommonProperties.xClearPreferredSizeCache(this); base.OnTextChanged(e); + + if (UiaCore.UiaClientsAreListening().IsTrue()) + { + RaiseAccessibilityTextChangedEvent(); + } } + private protected virtual void RaiseAccessibilityTextChangedEvent() + => AccessibilityObject.RaiseAutomationEvent(UiaCore.UIA.Text_TextChangedEventId); + /// /// Returns the character nearest to the given point. ///