• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

【.NETFramework&C#】What'snewinaccessibilityinthe.NETFramework

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

What's new in accessibility in the .NET Framework

The .NET Framework aims(vt. 目的在于;引导;把…对准) at making applications more accessible for your users. Accessibility features allow an application to provide an appropriate experience for users of Assistive Technology. Starting with the .NET Framework 4.7.1, the .NET Framework includes a large number of accessibility improvements that allow developers to create accessible applications.

Accessibility switches

You can configure your app to opt into accessibility features if it targets the .NET Framework 4.7 or an earlier version but is running on the .NET Framework 4.7.1 or later. You can also configure your app to use legacy(n. 遗赠,遗产) features (and not take advantage of accessibility features) if it targets the .NET Framework 4.7.1 or later. Each version of the .NET Framework that includes accessibility features has a version-specific accessibility switch, which you add to the <AppContextSwitchOverrides> element in the <runtime> section of the application's configuration file. The following are the supported switches:

Version Switch
.NET Framework 4.7.1 "Switch.UseLegacyAccessibilityFeatures"
.NET Framework 4.7.2 "Switch.UseLegacyAccessibilityFeatures.2"

Taking advantage of accessibility enhancements

The new accessibility features are enabled by default for applications that target the .NET Framework 4.7.1 or later. In addition, applications that target an earlier version of the .NET Framework but are running on the .NET Framework 4.7.1 or later can opt out of legacy accessibility behaviors (and thereby(adv. 从而,因此;在那附近;在那方面) take advantage of accessibility improvements) by adding switches to the <AppContextSwitchOverrides> element in the <runtime> section of the application's configuration file and setting their value to false. The following shows how to opt in to accessibility enhancements introduced in the .NET Framework 4.7.1:

<runtime>
    <!-- AppContextSwitchOverrides value attribute is in the form of 'key1=true|false;key2=true|false  -->
    <AppContextSwitchOverrides value="Switch.UseLegacyAccessibilityFeatures=false" />
</runtime>

If you choose to opt in to accessibility features in a later version of the .NET Framework, you must also explicitly opt in to the features from earlier versions of the .NET Framework. Configuring your app to take advantage of accessibility improvements in both the .NET Framework 4.7.1 and 4.7.2 requires the following <AppContextSwitchOverrides> element:

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

Restoring legacy behavior

Applications that target versions of the .NET Framework starting with 4.7.1 can disable accessibility features by adding switches to the <AppContextSwitchOverrides> element in the <runtime> section of the application's configuration file and setting their value to true. For example, the following configuration opts out of accessibility features introduced in .NET Framework 4.7.2:

<runtime>
    <!-- AppContextSwitchOverrides value attribute is in the form of 'key1=true|false;key2=true|false  -->
    <AppContextSwitchOverrides value="Switch.UseLegacyAccessibilityFeatures.2=true" />
</runtime>

What's new in accessibility in the .NET Framework 4.7.2

The .NET Framework 4.7.2 includes new accessibility features in the following areas:

Windows Forms

OS-defined colors in High Contrast(vi. 对比;形成对照) themes

Starting with .NET Framework 4.7.2, Windows Forms uses colors defined by the operating system in High Contrast themes. This affects the following controls:

Narrator(n. 叙述者;解说员) improvements

Starting with the .NET Framework 4.7.2, Narrator support is enhanced as follows:

DataGridView improvements

Starting with the .NET Framework 4.7.2, the DataGridView control has introduced the following accessibility improvements:

Improved visual cues

  • The RadioButton and CheckBox controls with an empty Text property display a focus indicator when they receive the focus.

Improved Property Grid Support

  • The PropertyGrid control child elements now return a true for the IsReadOnlyProperty property only when a PropertyGrid element is enabled.

  • The PropertyGrid control child elements return a false for the IsEnabledProperty property only when a PropertyGrid element can be changed by the user.

Improved keyboard navigation

Windows Presentation Foundation (WPF)

Changes to the CheckBox and RadioButton controls

In the .NET Framework 4.7.1 and earlier versions, the WPF CheckBox and RadioButton controls have inconsistent and, in Classic and High Contrast themes, incorrect focus visuals(adj. 视觉的,视力的;栩栩如生的). These issues occur in cases where the controls do not have any content set. This can make the transition(n. 过渡;转变;[分子生物] 转换;变调) between themes confusing and the focus visual hard to see.

In the .NET Framework 4.7.2, these visuals are now more consistent across themes and more easily visible in Classic and High Contrast themes.

WinForms controls hosted in a WPF application

For WinForms control hosted in a WPF application in the .NET Framework 4.7.1 and earlier versions, users couldn't tab out of the WinForms layer if the first or last control in that layer is the WPF ElementHost control. In the .NET Framework 4.7.2, users are now able to tab out of the WinForms layer.

However, automated applications that rely on focus never escaping the WinForms layer may no longer work as expected.

What's new in accessibility in the .NET Framework 4.7.1

The .NET Framework 4.7.1 includes new accessibility features in the following areas:

Windows Presentation Foundation (WPF)

Screen reader improvements

If accessibility improvements are enabled, the .NET Framework 4.7.1 includes the following enhancements that affect screen readers:

  • In the .NET Framework 4.7 and earlier versions, Expander controls were announced by screen readers as buttons. Starting with the .NET Framework 4.7.1, they are correctly announced as expandable/collapsible groups.

  • In the .NET Framework 4.7 and earlier versions, DataGridCell controls were announced by screen readers as “custom.” Starting with the .NET Framework 4.7.1, they are now correctly announced as data grid cell (localized).

  • Starting with the .NET Framework 4.7.1, screen readers announce the name of an editable(adj. 可编辑的) ComboBox.

  • In the .NET Framework 4.7 and earlier versions, PasswordBox controls were announced as “no item in view” or had otherwise incorrect behavior. This issue is fixed starting with the .NET Framework 4.7.1.

UIAutomation LiveRegion support

Screen readers such as Narrator help people read the UI contents of an application, usually by text-to-speech output of the UI content that has the focus. However, if a UI element changes and does not have the focus, the user may not be notified and may miss important information. Live regions aim at solving this problem. A developer can use them to inform(vt. 通知;告诉;报告) the screen reader or any other UIAutomation 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.

To support live regions, the following APIs have been added to WPF:

You can create a LiveRegion by setting the AutomationProperties.LiveSetting property on the element of interest, as shown in the following example:

<TextBlock Name="myTextBlock" AutomationProperties.LiveSetting="Assertive">announcement</TextBlock>

When the data in the live region changes and you need to inform a screen reader, you explicitly raise an event, as shown in the following sample.

var peer = FrameworkElementAutomationPeer.FromElement(myTextBlock);

peer.RaiseAutomationEvent(AutomationEvents.LiveRegionChanged);

High contrast

Starting with the .NET Framework 4.7.1, improvements in high contrast have been made to various WPF controls. They are now visible when the HighContrast theme is set. These include:

  • Expander control

    The focus visual for the Expander control is now visible. The keyboard visuals for ComboBox,ListBox, and RadioButton controls are visible as well. For example:

    Before:

    After:

  • CheckBox and RadioButton controls

    The text in the CheckBox and RadioButton controls is now easier to see when selected in high contrast themes. For example:

    Before:

    After:

  • ComboBox control

    Starting with the .NET Framework 4.7.1, the border of a disabled ComboBox control is the same color as disabled text. For example:

    Before:

    After:

    In addition, disabled and focused buttons use the correct theme color.

    Before:

    After:

    Finally, in the .NET Framework 4.7 and earlier versions, setting a ComboBox control’s style to Toolbar.ComboBoxStyleKey caused the drop-down arrow to be invisible. This issue is fixed starting with the .NET Framework 4.7.1. For example:

    Before:

    After:

  • DataGrid control

    Starting with the .NET Framework 4.7.1, the sort indicator arrow in DataGrid controls now uses correct theme colors. For example:

    Before:

    After:

    In addition, in the .NET Framework 4.7 and earlier versions, the default link style changed to an incorrect color on mouse over in high contrast modes. This is resolved starting with the .NET Framework 4.7.1. Similarly, DataGrid checkbox columns uses the expected colors for keyboard focus feedback starting with the .NET Framework 4.7.1.

    Before:

    After:

For more information on WPF accessibility improvements in the .NET Framework 4.7.1, see Accessibility improvements in WPF.

Windows Forms accessibility improvements

In the .NET Framework 4.7.1, Windows Forms (WinForms) includes accessibility changes in the following areas.

Improved display in High Contrast mode

Starting with the .NET Framework 4.7.1, various WinForms controls offer improved rendering in the HighContrast modes available in the operating system. Windows 10 has changed the values for some high contrast system colors, and Windows Forms is based on the Windows 10 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(vt. 证明,表明;显示) file in a test application and un-comment the Windows 10 supported OS line so that it looks the following:

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

Some examples of high contrast changes include:

  • Checkmarks in MenuStrip items are easier to view.

  • When selected, disabled MenuStrip items are easier to view.

  • Text in a selected Button control contrasts with the selection color.

  • Disabled text is easier to read. For example:

    Before:

    After:

  • High contrast improvements in the Thread Exception Dialog.

Improved Narrator support

Windows Forms in the .NET Framework 4.7.1 includes the following accessibility improvements for the Narrator:

  • The MonthCalendar control can be accessed by the Narrator, as well as by other UI automation tools.

  • The CheckedListBox control notifies Narrator when an item's check state has changed so the user is notified that they’ve changed the value of a list item.

  • The DataGridViewCell control reports the correct read-only status to Narrator.

  • Narrator can now read disabled ToolStripMenuItem text, whereas(conj. 然而;鉴于;反之) previously it would skip over disabled menu items.

Enhanced support for UIAutomation accessibility patterns

Starting with the .NET Framework 4.7.1, developers of accessibility technology tools can leverage common API accessibility patterns and properties for several WinForms controls. These accessibility improvements include:

Improved property browser experience

Starting with the .NET Framework 4.7.1, Windows Forms includes:

  • Better keyboard navigation through the various drop-down selection windows.
  • A reduction of unnecessary tab stops.
  • Better reporting of control types.
  • Improved narrator behavior.

ASP.NET web controls

Starting with the .NET Framework 4.7.1 and Visual Studio 2017 15.3, ASP.NET improves how ASP.NET web controls work with accessibility technology in Visual Studio. Changes include the following:

  • Changes to implement missing UI accessibility patterns in controls, like the Add Field dialog in the Details View wizard, or the Configure ListView dialog of the ListView wizard.

  • Changes to improve the display in High Contrast mode, like the Data Pager Fields Editor.

  • Changes to improve the keyboard navigation experiences for controls, like the Fields dialog in the Edit Pager Fields wizard of the DataPager control, the Configure ObjectContext dialog, or the Configure Data Selection dialog of the Configure Data Source wizard.

.NET SDK Tools

The Configuration Editor Tool (SvcConfigEditor.exe) and Service Trace Viewer Tool (SvcTraceViewer.exe) have been improved by fixing varied accessibility issues. Most of these were small issues, like a name not being defined or certain UI automation patterns not being implemented correctly. While many users won’t be aware of these incorrect values, customers who use assistive technologies like screen readers will find these SDK tools more accessible.

These enhancements change some previous behaviors, such as keyboard focus order.

Windows Workflow Foundation (WF) Workflow Designer

Accessibility changes in the Workflow Designer include the following:

  • The tab order changes to left to right and top to bottom in some controls:

  • More functions are available via the keyboard:

    • When editing the properties of an activity, property groups can be collapsed by keyboard the first time they are focused.

    • Warning icons are accessible by keyboard.

    • The More Properties button in the Properties window is accessible by keyboard.

    • Keyboard users can access the header items in the Arguments and Variables panes(n. 窗格;边;面;窗格玻璃;嵌板) of the Workflow Designer.

  • Improved visibility of items with focus, such as when:

    • Adding rows to data grids used by the Workflow Designer and activity designers.

    • Tabbing through fields in the ReceiveReply and SendReply activities.

    • Setting default values for variables or arguments

  • Screen readers can now correctly recognize:

    • Breakpoints set in the workflow designer.

    • The FlowSwitch<T>FlowDecision, and CorrelationScope activities.

    • The contents of the Receive activity.

    • The Target Type for the InvokeMethod activity.

    • The Exception combo box and the Finally section in the TryCatch activity.

    • The Message Type combo box, the splitter in the Add Correlation Initializers window, the Content Definition window, and the CorrelatesOn Definition window in the messaging activities (ReceiveSendSendReply, and ReceiveReply).

    • State machine transitions(n. 过渡,转变) and transitions destinations(n. 目的地,终点;).
    • Annotations(释文;注释) and connectors on FlowDecision activities.
    • The context (right-click) menus for activities.
    • The property value editors, the Clear Search button, the By Category and Alphabetical(adj. 字母的;[计] 依字母顺序的) sort buttons, and the Expression Editor dialog in the properties grid.
    • The zoom percentage in the Workflow Designer.
    • The separator in Parallel and Pick activities.
    • The InvokeDelegate(vt. 委派…为代表;n. 代表) activity.
    • The Select Types window for dictionary activities (Microsoft.Activities.AddToDictionary<TKey,TValue>Microsoft.Activities.RemoveFromDictionary<TKey,TValue>, etc.).
    • The Browse and Select .NET Type window.
    • Breadcrumbs(n. 面包碎屑;vt. 在…上覆以面包屑) in the Workflow Designer.
  • Users who choose High Contrast themes will see many improvements in the visibility of the Workflow Designer and its controls, like better contrast ratios between elements and more noticeable selection boxes used for focus elements.

See Also

What's new in the .NET Framework


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C#IndexOf不区分大小写发布时间:2022-07-10
下一篇:
如何使用C#和VB发送和接收MSMQ消息发布时间:2022-07-10
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap