-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Implementing HeadingLevel and IsDialog automation properties #4751
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@@ -139,6 +143,10 @@ static OSVersionHelper() | |||
[return: MarshalAs(UnmanagedType.I1)] | |||
static extern bool IsWindows10RS5OrGreater(); | |||
|
|||
[DllImport(DllImport.PresentationNative, CallingConvention = CallingConvention.Cdecl)] | |||
[return: MarshalAs(UnmanagedType.I1)] | |||
static extern bool IsWindows10RS4OrGreater(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need to implement this method in native code for this to work:
You can add it here:
And set _RS4_BUILD_NUMBER to 17134 here:
#define _RS3_BUILD_NUMBER 16299 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, @ThomasGoulet73. IsWindows10RS4OrGreater and the others are implemented in PresentationNative, which is in a separate internal WPF repo.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a historical reason why IsWindows10RS4OrGreater etc are sitting in PresentationNative. It should be possible to move these to an open source assembly (esp to minimize the footprint of closed-source where possible) without problems.
When we originally added these years ago (circa .NET 4.6.1 probably), the only way to do reliable OS version checks was by calling RtlVerifyVersionInfo API’s - VerifyVersionInfo didn’t work well and it required application manifests which was not feasible from a DLL. RtlVerifyVersionInfo at that time was only documented as being available via NtosKrnl.lib - the ntdll.dll export was well known but hadn’t been officially documented at that time (on MSDN/docs.Microsoft.com). So instead of just P/Invoking into RtlVerifyVersionInfo, we linked PresentationNative to NtosKrnl.lib to get access to RtlVerifyVersionInfo and exported our own functions from there to P/Invoke into (remember, .NET and thus WPF only uses documented API’s).
Forward a few years RtlVerifyVersionInfo was documented as a dual mode API exported out of ntdll.dll (and NtosKrnl.exe) and this complicated way of consuming that API was no longer needed (now instead of linking to NtosKrnl.lib, we could P/Invoke into ntdll.dll if that’s what we preferred) - but we never changed the approach.
src/Microsoft.DotNet.Wpf/src/Shared/System/Windows/InterOp/OSVersionHelper.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.DotNet.Wpf/src/Shared/System/Windows/InterOp/OperatingSystemVersion.cs
Outdated
Show resolved
Hide resolved
...otNet.Wpf/src/UIAutomation/UIAutomationClient/System/Windows/Automation/AutomationElement.cs
Outdated
Show resolved
Hide resolved
...src/UIAutomation/UIAutomationTypes/System/Windows/Automation/AutomationElementIdentifiers.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Automation/Peers/AutomationPeer.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Automation/Peers/AutomationPeer.cs
Show resolved
Hide resolved
src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Automation/Peers/AutomationPeer.cs
Show resolved
Hide resolved
src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Automation/AutomationProperties.cs
Show resolved
Hide resolved
...icrosoft.DotNet.Wpf/src/PresentationCore/System/Windows/Automation/AutomationHeadingLevel.cs
Show resolved
Hide resolved
…utomation/AutomationProperties.cs Co-authored-by: ThomasGoulet73 <51839772+ThomasGoulet73@users.noreply.github.com>
…ystem/Windows/Automation/AutomationElement.cs Co-authored-by: ThomasGoulet73 <51839772+ThomasGoulet73@users.noreply.github.com>
…stem/Windows/Automation/AutomationElementIdentifiers.cs Co-authored-by: ThomasGoulet73 <51839772+ThomasGoulet73@users.noreply.github.com>
…utomation/Peers/AutomationPeer.cs Co-authored-by: ThomasGoulet73 <51839772+ThomasGoulet73@users.noreply.github.com>
…stem/Windows/Automation/AutomationElementIdentifiers.cs Co-authored-by: ThomasGoulet73 <51839772+ThomasGoulet73@users.noreply.github.com>
…ersionHelper.cs Co-authored-by: ThomasGoulet73 <51839772+ThomasGoulet73@users.noreply.github.com>
...t.Wpf/src/UIAutomation/UIAutomationTypes/System/Windows/Automation/AutomationHeadingLevel.cs
Outdated
Show resolved
Hide resolved
...DotNet.Wpf/src/PresentationFramework/System/Windows/Automation/Peers/WindowAutomationPeer.cs
Outdated
Show resolved
Hide resolved
…pat errors" This reverts commit 0afb956, as it creates some problems when running wpf
…ows/Automation/Peers/WindowAutomationPeer.cs Co-authored-by: Sam Bent <sambent@microsoft.com>
src/Microsoft.DotNet.Wpf/src/UIAutomation/UIAutomationClient/ref/UIAutomationClient.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.DotNet.Wpf/src/UIAutomation/UIAutomationTypes/ref/UIAutomationTypes.cs
Outdated
Show resolved
Hide resolved
@guimafelipe: Sam has signed off. Can you squash and merge? |
Hi All, Please let us know when will this Accessibility Header Level feature will be released to PresentationFramework to integrate with our WPF XAML application as we are getting complaints from Accessibility assessment teams and also from Accessibility challenged users. Thanks, |
Hey @vedeevi, this was added in .Net 6.0.0-preview.7 and I have validated that the added apis do exist on my machine which has .Net 6.0.1 installed. To my knowledge, this has not been added to .Net Framework so it requires .Net 6 (Though someone from the WPF team might want to correct me). |
That's correct. .NET 6 has the new apis. On the .NET Framework side, the plan is to include them in the next release (.NET 4.8.1). |
Fixes Issue #1825
Description
The HeadingLevel property was not implemented in WPF yet. This PR implements this property.
The IsDialog property was algo not implemented. This PR implements this property.
Customer Impact
Customers will now be able to set the HeadingLevel and the isDialog automation properties in WPF projects.
Regression
No regression.
Testing
Manually tested