【发布时间】:2022-03-24 02:40:11
【问题描述】:
我正在编写一个 WPF (.net 5) 应用程序,该应用程序应该支持可访问性,特别是 windows 叙述者以读出屏幕文本。我使用了很少的TextBlocks,并希望一旦显示窗口,叙述者就会开始一一阅读屏幕上的所有文本。
我观察到,当Button 的内容被读出时,任何TextBlock 的内容根本不会被叙述者阅读。
如何让旁白将窗口的所有内容一一读出。
<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>
【问题讨论】:
标签: wpf windows accessibility narrator