I have a C# application that uses the property grid. When I edit a ContentAlignment property I get this error message:
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.
This may be related to updating the framework to 4.6.1.
I only see this error the first time I edit the property.
How do I opt in to the accessibility improvements to not see this error?
According to the blog post .NET Framework 4.7.1 Accessibility and WPF Improvements, if your app is running on the .NET Framework 4.7.1 or later but targets an earlier .NET Framework, you need to add the following to your app.config file in order to opt-in to the accessibility improvements.
<runtime>
<!-- AppContextSwitchOverrides value attribute is in the form of 'key1=true|false;key2=true|false -->
<AppContextSwitchOverrides value="Switch.UseLegacyAccessibilityFeatures=false" />
</runtime>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With