dotnet/Documentation/compatibility/wpf-accessibility-improveme...

5.6 KiB

Accessibility improvements in WPF

Scope

Major

Version Introduced

4.7.1

Source Analyzer Status

NotPlanned

Change Description

High Contrast improvements

Screen reader interaction improvements

LiveRegion support

Screen readers such as Narrator help people know the UI contents of an application, usually by describing something about the UI that's currently focused, because that is probably the element of most interest to the user. However, if a UI element changes somewhere in the screen and it does not have the focus, the user may not be informed and miss important information. LiveRegions are meant to solve this problem. A developer can use them to inform the screen reader or any other [UI Automation]UI Automation Overview client that an important change has been made to a UI element. The screen reader can then decide how and when to inform the user of this change. The LiveSetting property also lets the screen reader know how important it is to inform the user of the change made to the UI.

  • 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.1 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.1. These accessibility changes are enabled by default on WPF applications that target the .NET Framework 4.7.1 or later.
  • It opts out of the legacy accessibility behaviors by adding the following AppContext Switch in 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" />
      </runtime>
    </configuration>

Applications that target the .NET Framework 4.7.1 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.

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

Affected APIs

  • F:System.Windows.Automation.AutomationElementIdentifiers.LiveSettingProperty
  • F:System.Windows.Automation.AutomationElementIdentifiers.LiveRegionChangedEvent
  • T:System.Windows.Automation.AutomationLiveSetting
  • F:System.Windows.Automation.AutomationProperties.LiveSettingProperty
  • M:System.Windows.Automation.AutomationProperties.SetLiveSetting(System.Windows.DependencyObject,System.Windows.Automation.AutomationLiveSetting)
  • M:System.Windows.Automation.AutomationProperties.GetLiveSetting(System.Windows.DependencyObject)
  • M:System.Windows.Automation.Peers.AutomationPeer.GetLiveSettingCore

Category

WPF