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

How to opt in to accessibility improvements?

我有一个使用 属性 网格的 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 有关。

我第一次编辑 属性 时才看到这个错误。

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

根据博客 post .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>