c# - 如何选择加入可访问性改进?

标签 c# accessibility-api

我有一个使用属性网格的 C# 应用程序。当我编辑 ContentAlignment 属性时,我收到此错误消息:

Desktop applications are required to opt in to all earlier accessibility improvements to get the later improvements. To do this, ensure that if the AppContext switch 'Switch.UseLegacyAccessibilityFeatures.N' is set to 'false', then 'Switch.UseLegacyAccessibilityFeatures' and all 'Switch.UseLegacyAccessibilityFeatures.M' switches, when M < N, evaluate to false as well. Note that, if a switch for a particular set of accessibility improvements is not present, its value is determined by the target framework version. You can remedy this by adding these switches and setting their value to false.

这可能与更新框架到4.6.1有关。

我只在第一次编辑属性时看到此错误。

如何选择加入可访问性改进以不看到此错误?

最佳答案

根据博文.NET Framework 4.7.1 Accessibility and WPF Improvements ,如果您的应用程序在 .NET Framework 4.7.1 或更高版本上运行但以更早的 .NET Framework 为目标,您需要将以下内容添加到您的 app.config 文件中以选择加入辅助功能改进。

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

关于c# - 如何选择加入可访问性改进?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50417999/

相关文章:

android - 如何从AccessibilityNodeInfo获取webview

C# 检查两个时间跨度之间的时间跨度

c# - 为什么要在 char 上使用定界符?基于c的

javascript - Js如何从fetch()获取数据到服务器?

android - 无障碍服务未启动

macos - Mac App Store 中的应用程序能否获得辅助功能许可?

c# - 如何在网页(cshtml)中操作文本文件?

c# - 如何运行 xamarin 表单设计器?

Android:如何检查是否启用了特定的 AccessibilityService

cocoa - 窗口可调整大小 - kAXGrowAreaAttribute 始终返回 NULL