I've got an application that's written in C# using .NET Framework 3.5 and want to automate the UI using Microsoft UI Automation Framework. I'm not allowed to show everything here, because it's a software from my company.
In this application I'm generating a grid that displays my data items.
I've tried to set the automationIDs for every data item in the grid through XAML, but the problem is, that I can't see the dataitems there. They are dynamically generated during runtime of my application. Only the grid that contains the data items is defined in the XAML. I will post a snippet of my XAML below.
I've also tried to set the automationIDs through the Code of the program, but I only managed to get the AutomationElement of every data item. There I'm stuck. I don't know how to set the automationIds for every AutomationElement there.
To sum it up I am either looking for:
Screenshot of my Inspect Tool: Inspect Tool
Snippet of my XAML Code:
<ListView IsEnabled="{Binding TestSelectorEnabled}" x:Name="ListView1" ItemsSource="{Binding TestsViewModel.TestsDataTable}" SelectedValue="{Binding TestsViewModel.SelectedTest}" SelectedValuePath="TestName" Height="180" View="{Binding TestsViewModel.GridView}" TabIndex="0" MinWidth="1" Focusable="False"/>
<Grid Visibility="Collapsed" IsSharedSizeScope="False">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="200"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="40"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="25"></RowDefinition>
<RowDefinition Height="20"></RowDefinition>
</Grid.RowDefinitions>
</Grid>
Try to specify ItemTemplate explicitly, it will let you set ids. It should be an automation API to iterate though ListView children as well.