1

I am writing a WPF (.net 5) application which should support accessibility specifically windows narrator to read out the screen text. I am using few TextBlocks and expect that as soon as window is shown narrator will start reading all the text present in the screen one by one.

What I observe is that while the Button's content are read out, any TextBlock content is not read by narrator at all.

How can I make the narrator to read all the content of the window one by one.

<Window x:Class="SampleApp.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:SampleApp"
        mc:Ignorable="d"
        TabIndex="0"
        Focusable="True"
        Title="MainWindow" Height="450" Width="800">
    <Grid>
        <StackPanel VerticalAlignment="Center" HorizontalAlignment="Center">
            <TextBlock x:Name="firstText"
                       Text="This is the first line"
                       KeyboardNavigation.TabIndex="1"
                       KeyboardNavigation.TabNavigation="Continue"
                       AutomationProperties.AutomationId="firstTextBox"
                       AutomationProperties.Name="This is the first line"
                       />
            <TextBlock x:Name="secondText"
                       Text="This is the second line"
                       KeyboardNavigation.TabIndex="2"
                       KeyboardNavigation.TabNavigation="Continue"
                       AutomationProperties.AutomationId="secondTextBox"
                       AutomationProperties.Name="This is the second line"
                       />
        </StackPanel>

    </Grid>
</Window>
4

0 回答 0