问题
I've got a problem with Microsoft Narrator.
I've got a WPF fragment like this:
<Window
x:Class="InlineEditbox.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Narrator test" SizeToContent="WidthAndHeight">
<TextBlock>
<Run xml:space="preserve">I want to pay </Run>
<InlineUIContainer>
<TextBox Width="70" HorizontalContentAlignment="Right">0</TextBox>
</InlineUIContainer>
<Run xml:space="preserve"> % more</Run>
</TextBlock>
</Window>
The text is displayed correctly; however the Narrator reads it this way: "I want to pay percent more, zero" instead of the expected "I want to pay 0 percent more".
Am I doing something wrong? The Narrator could have read the whole text just consequently. Is there a way to work around the problem without the need to change the actual text?
回答1:
Answer from WPF team member:
WPF supports a text control that can have child controls intermixed with its text. The UI Automation tree does not. There is no way describe to automation clients where the child edit control lives within the parent's text. WPF cannot easily fix this - it's a limitation of the automation architecture.
To workaround, one can put the text into separate controls to describe the order in a way that translates to automation:
<TextBlock>I want to pay</TextBlock>
<TextBox> 0 </TextBox>
<TextBlock>% more</TextBlock>
Thx, Rob Relyea
WPF Team
回答2:
Don't use narrator, it's an extremely basic screen reading program and is not generally used by people who need to use a screen reader on a daily basis. See the following question for reccomendations on screen readers to use. Which screen reader would be best to test site accessibility and how to configure that?
来源:https://stackoverflow.com/questions/3201842/wrong-reading-order-in-narrator