title | description | type | page_title | slug | tags | res_type |
---|---|---|---|---|---|---|
UI Automation Issue with RadGridView on .NET 8 |
This article provides workaround for the issue where UI Automation doesn't work in WPF after migrating to .NET 8. |
troubleshooting |
UI Automation Not Created in WPF Under .NET 8 |
kb-common-net8-automationpeers-issue |
radgridview, ui, automation, net8, peers |
kb |
Product | Version |
---|---|
UI for WPF | 2023.3.1114 |
Automation peers cannot be accessed by UI Automation tests in a WPF project targeting .NET 8.
This is a bug in .NET 8 which is described in the following two Microsoft items:
To work it around, set the static _ItemsControlDoesNotSupportAutomation
internal field of the System.Windows.AccessibilitySwitches
class.
{{region kb-common-net8-automationpeers-issue-0}} public partial class App : Application { public App() { var accessibilitySwitches = Type.GetType("System.Windows.AccessibilitySwitches, WindowsBase, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"); var field = accessibilitySwitches.GetField("_ItemsControlDoesNotSupportAutomation", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Static | BindingFlags.DeclaredOnly); field.SetValue(null, 1); } } {{endregion}}