# UI Automation Issue with RadGridView on .NET 8

## Environment

| Product    | Version     |
| ---------- | ----------- |
| UI for WPF | 2023.3.1114 |

## Description

Automation peers cannot be accessed by UI Automation tests in a  WPF project targeting .NET 8.

## Solution

This is a bug in .NET 8 which is described in the following two Microsoft items:

* [Fix ItemsControl Automation Again #8715](https://github.com/dotnet/wpf/pull/8715)
* [Windows Automation tree breaking change #8679](https://github.com/dotnet/wpf/issues/8679)

To work it around, set the static `_ItemsControlDoesNotSupportAutomation` internal field of the `System.Windows.AccessibilitySwitches` class.

```C#
	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);
		}
	}
```
