Skip to content
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

Implementing HeadingLevel and IsDialog automation properties #4751

Merged
merged 44 commits into from
Jul 15, 2021

Conversation

guimafelipe
Copy link
Member

@guimafelipe guimafelipe commented Jun 25, 2021

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

@ghost ghost added the PR metadata: Label to tag PRs, to facilitate with triage label Jun 25, 2021
@ghost ghost requested review from fabiant3 and SamBent June 25, 2021 14:42
@dnfadmin
Copy link

dnfadmin commented Jun 25, 2021

CLA assistant check
All CLA requirements met.

@guimafelipe guimafelipe marked this pull request as ready for review June 25, 2021 17:40
@guimafelipe guimafelipe requested a review from a team as a code owner June 25, 2021 17:40
@guimafelipe guimafelipe reopened this Jul 1, 2021
@guimafelipe guimafelipe changed the title Implementing HeadingLevel automation property Implementing HeadingLevel and IsDialog automation properties Jul 5, 2021
@@ -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();
Copy link
Contributor

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:

Copy link
Member

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.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @ryalanms! I didn't know that the PresentationNative is closed source and that the project in this repo is simply a redist. Is it planned to open-source PresentationNative or is the status still the same as #2554 ?

Copy link
Member

@vatsan-madhavan vatsan-madhavan Jul 8, 2021

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.

Felipe da Conceicao Guimaraes and others added 9 commits July 6, 2021 12:40
…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>
Felipe da Conceicao Guimaraes added 2 commits July 14, 2021 22:29
@ryalanms
Copy link
Member

@guimafelipe: Sam has signed off. Can you squash and merge?

@vedeevi
Copy link

vedeevi commented Feb 8, 2022

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,
vedeevi.

@ThomasGoulet73
Copy link
Contributor

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).

@SamBent
Copy link
Contributor

SamBent commented Feb 8, 2022

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).

@vishalmsft vishalmsft deleted the new.automation.property branch February 10, 2022 06:04
@ghost ghost locked as resolved and limited conversation to collaborators Apr 8, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
PR metadata: Label to tag PRs, to facilitate with triage
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants