Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7414655
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T07:08:36+00:00 2026-05-29T07:08:36+00:00

I have a WPF DataGrid control that is binding to a collection of objects.

  • 0

I have a WPF DataGrid control that is binding to a collection of objects. Everything is rendering on-screen as it should be.

ToString() has been overridden due to requirements elsewhere in the application.

The issue is that, when read by a screen reader (such as Microsoft’s built-in Narrator), or when inspected via a tool like AccChecker / Inspect, the control’s name is the overridden ToString value.

I want to be able to specify a descriptive name for the screen reader, but I can’t find a method of doing so. I’ve tried setting AutomationProperties.Name, AutomationProperties.ItemType, and so forth, but none of the properties in AutomationProperties seem to have the desired effect.

Optimally, I’d be able to do this for both the data item itself, and also for the individual members of the columns.

Here’s a complete demo of the issue I’m experiencing:

<DataGrid x:Name="dgTest" ItemsSource="{Binding}" AutoGenerateColumns="false" AutomationProperties.Name="Test">
    <DataGrid.Columns>
        <DataGridTemplateColumn Header="Name" IsReadOnly="True" Width="2*" AutomationProperties.Name="Test2">
            <DataGridTemplateColumn.CellTemplate>
                <DataTemplate>
                    <TextBlock Text="{Binding Path=Name}"/>
                </DataTemplate>
            </DataGridTemplateColumn.CellTemplate>
        </DataGridTemplateColumn>
            <DataGridTemplateColumn Header="ID" IsReadOnly="True" Width="2*">
            <DataGridTemplateColumn.CellTemplate>
                <DataTemplate>
                    <TextBlock Text="{Binding Path=Id}"/>
                </DataTemplate>
            </DataGridTemplateColumn.CellTemplate>
        </DataGridTemplateColumn>
    </DataGrid.Columns>
</DataGrid>

And the code:

public class FooItem
{
    public Guid Id { get; set; }
    public string Name { get; set; }

    public override string ToString()
    {
        return string.Concat(Id.ToString(), " : ", Name);
    }
}

public partial class MainWindow : Window
{
    public readonly List<FooItem> fooList = new List<FooItem>();
    public MainWindow()
    {
        fooList.Add(new FooItem { Id = Guid.NewGuid(), Name = "Test 1" });
        fooList.Add(new FooItem { Id = Guid.NewGuid(), Name = "Test 2" });
        fooList.Add(new FooItem { Id = Guid.NewGuid(), Name = "Test 3" });

        InitializeComponent();
        dgTest.DataContext = fooList;
    }
}

And just for completeness, here’s a screenshot of Inspector.
full size image
Inspector screenshot

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T07:08:36+00:00Added an answer on May 29, 2026 at 7:08 am

    I found a solution… I had to use a style on DataGrid.ItemContainerStyle and DataGridTemplateColumn.HeaderStyle to set AutomationProperties.Name.

    Ex:

    <DataGrid x:Name="dgTest" ItemsSource="{Binding}" AutoGenerateColumns="false" AutomationProperties.Name="Test"> 
        <DataGrid.ItemContainerStyle>
             <Style>
                  <Setter Property="AutomationProperties.Name" Value="Row Item" />
             </Style>
        </DataGrid.ItemContainerStyle>
        <DataGrid.Columns> 
            <DataGridTemplateColumn Header="Name" IsReadOnly="True" Width="2*" AutomationProperties.Name="Test2"> 
                <DataGridTemplateColumn.CellTemplate> 
                    <DataTemplate> 
                        <TextBlock Text="{Binding Path=Name}"/> 
                    </DataTemplate> 
                </DataGridTemplateColumn.CellTemplate> 
            </DataGridTemplateColumn> 
                <DataGridTemplateColumn Header="ID" IsReadOnly="True" Width="2*"> 
                <DataGridTemplateColumn.CellTemplate> 
                    <DataTemplate> 
                        <TextBlock Text="{Binding Path=Id}"/> 
                    </DataTemplate> 
                </DataGridTemplateColumn.CellTemplate> 
            </DataGridTemplateColumn> 
        </DataGrid.Columns> 
    </DataGrid>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a nice WPF DataGrid binded to a collection of objects. Everything works
I have a user control that contains a WPF toolkit DataGrid . This control
I have a WPF user control that contains a DataGrid. This DG contains several
I have a DataGrid control in a WPF application. I want to be able
I have the next code where I defined a WPF toolkit datagrid control called
I have a WPF form that contains a DataGrid. This DataGrid is editable. One
I am working on a WPF datagrid custom control, where i have a Day
I have been having trouble with the WPF DataGrid and listbox GridView performance when
I have a WPF app that uses DataGrid to display some data. When I
I have a WPF application with a screen containing a tab control with two

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.