dotnet/Documentation/compatibility/winforms-accessibility-chan...

6.6 KiB

Accessibility improvements in Windows Forms controls for .NET 4.7.2

Scope

Major

Version Introduced

4.7.2

Source Analyzer Status

NotPlanned

Change Description

Windows Forms Framework is improving how it works with accessibility technologies to better support Windows Forms customers. These include the following changes:

  • Changes to improve display during High Contrast mode.

  • Changes to improve the keyboard navigation in the DataGridView and MenuStrip controls.

  • Changes to interaction with Narrator.

  • Quirked

  • Build-time break

How to opt in or out of these changes

In order for the application to benefit from these changes, it must run on the .NET Framework 4.7.2 or later. The application can benefit from these changes in either of the following ways:

  • It is recompiled to target the .NET Framework 4.7.2. These accessibility changes are enabled by default on Windows Forms applications that target the .NET Framework 4.7.2 or later.
  • It targets the .NET Framework 4.7.1 or earlier version and opts out of the legacy accessibility behaviors by adding the following AppContext Switch to the <runtime> section of the app config file and setting it to false, as the following example shows.
    <?xml version="1.0" encoding="utf-8"?>
    <configuration>
      <startup>
        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7"/>
      </startup>
      <runtime>
        <!-- AppContextSwitchOverrides value attribute is in the form of 'key1=true|false;key2=true|false  -->
        <AppContextSwitchOverrides value="Switch.UseLegacyAccessibilityFeatures=false;Switch.UseLegacyAccessibilityFeatures.2=false" />
      </runtime>
    </configuration>

Note that to opt in to the accessibility features added in .NET Framework 4.7.2, you must also opt in to accessibility features of .NET Framework 4.7.1 as well. Applications that target the .NET Framework 4.7.2 or later and want to preserve the legacy accessibility behavior can opt in to the use of legacy accessibility features by explicitly setting this AppContext switch to true.

Use of OS-defined colors in High Contrast themes

NOTE: Windows 10 has changed values for some high contrast system colors. Windows Forms Framework is based on the Win32 framework. For the best experience, run on the latest version of Windows and opt in to the latest OS changes by adding an app.manifest file in a test application and uncommenting the following code:

    <!-- Windows 10 -->
    <supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />

Improved Narrator support

Improved DataGridView Accessibility support

Improved Visual cues

Improved Property Grid Support

For an overview of UI automation, see the UI Automation Overview.

Improved keyboard navigation

Affected APIs

Category

Windows Forms