diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Controls/TextAdaptor.cs b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Controls/TextAdaptor.cs index 4c919d90d11..86ff97a0238 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Controls/TextAdaptor.cs +++ b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Controls/TextAdaptor.cs @@ -308,8 +308,9 @@ internal ITextRangeProvider TextRangeFromTextPointers(ITextPointer rangeStart, I rangeEnd = rangeStart; } - // return the resulting range - return new TextRangeAdaptor(this, rangeStart, rangeEnd, _textPeer); + // return the resulting range, wrapped so that it's ready for use by UIA + ITextRangeProvider textRange = new TextRangeAdaptor(this, rangeStart, rangeEnd, _textPeer); + return TextRangeProviderWrapper.WrapArgument(textRange, _textPeer); } #endregion Internal Methods diff --git a/src/Microsoft.DotNet.Wpf/src/UIAutomation/UIAutomationClient/MS/Internal/Automation/UiaCoreApi.cs b/src/Microsoft.DotNet.Wpf/src/UIAutomation/UIAutomationClient/MS/Internal/Automation/UiaCoreApi.cs index e0b3554ed11..2441d78d391 100644 --- a/src/Microsoft.DotNet.Wpf/src/UIAutomation/UIAutomationClient/MS/Internal/Automation/UiaCoreApi.cs +++ b/src/Microsoft.DotNet.Wpf/src/UIAutomation/UIAutomationClient/MS/Internal/Automation/UiaCoreApi.cs @@ -689,6 +689,19 @@ internal static AutomationEventArgs GetUiaEventArgs(IntPtr argsAddr) int[] runtimeId = ArrayFromIntPtr(wcargs._pRuntimeId, wcargs._cRuntimeIdLen); return new WindowClosedEventArgs(runtimeId); } + + case EventArgsType.Notification: + { + UiaNotificationEventArgs nargs = (UiaNotificationEventArgs)Marshal.PtrToStructure(argsAddr, typeof(UiaNotificationEventArgs)); + return new NotificationEventArgs(nargs._notificationKind, nargs._notificationProcessing, + Marshal.PtrToStringUni(nargs._displayString), Marshal.PtrToStringUni(nargs._activityId)); + } + + case EventArgsType.ActiveTextPositionChanged: + { + UiaActiveTextPositionChangedEventArgs atpcargs = (UiaActiveTextPositionChangedEventArgs)Marshal.PtrToStructure(argsAddr, typeof(UiaActiveTextPositionChangedEventArgs)); + return new ActiveTextPositionChangedEventArgs(atpcargs._textRange); + } } Debug.Assert(false, "Unknown event type from core:" + args._type); @@ -1448,7 +1461,11 @@ private enum EventArgsType PropertyChanged, StructureChanged, AsyncContentLoaded, - WindowClosed + WindowClosed, + TextEditTextChanged, + Changes, + Notification, + ActiveTextPositionChanged } [StructLayout(LayoutKind.Sequential)] @@ -1498,6 +1515,25 @@ private struct UiaWindowClosedEventArgs internal int _cRuntimeIdLen; } + [StructLayout(LayoutKind.Sequential)] + private struct UiaNotificationEventArgs + { + internal EventArgsType _type; + internal int _eventId; + internal AutomationNotificationKind _notificationKind; + internal AutomationNotificationProcessing _notificationProcessing; + internal IntPtr _displayString; + internal IntPtr _activityId; + } + + [StructLayout(LayoutKind.Sequential)] + private struct UiaActiveTextPositionChangedEventArgs + { + internal EventArgsType _type; + internal int _eventId; + internal ITextRangeProvider _textRange; + } + #endregion Private types //------------------------------------------------------