JAWS or windows narrator not working for label and tooltip for c# wpf application

Ajay Gera 40 Reputation points
2024-09-27T14:54:07.38+00:00

Hi,

I am using JAWS screen reader / windows narrator on wpf dialog for wpf application.

But reader does not says about label text and tooltip on hovering on the label.

I have used AutomationProperties.Name , AutomationProperties.LabeledBy as per link https://learn.microsoft.com/en-us/windows/apps/design/accessibility/basic-accessibility-information

but still no help

Can you please let me know or share sample code how to fix screen reader issue for label and tooltip?

Windows Presentation Foundation
Windows Presentation Foundation
A part of the .NET Framework that provides a unified programming model for building line-of-business desktop applications on Windows.
2,768 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,899 questions
0 comments No comments
{count} votes

Accepted answer
  1. Hongrui Yu-MSFT 1,765 Reputation points Microsoft Vendor
    2024-09-30T06:15:03.1966667+00:00

    Hi,@Ajay Gera. Welcome to Microsoft Q&A. 

    You could try the following method to let Narrator read the text content in Label.

     

    You need to bind AutomationProperties.Name to Label.Context, and focus it manually (Label is not like button, which automatically focuses when clicked).

     

    For the ToolTip in Label, it cannot be read by AutomationProperties.HelpText like Button.

    You could directly read the content of ToolTip through System.Speech.Synthesis without going through Narrator.

     

    System.Speech.Synthesis requires the installation of the corresponding library. In the .Net environment, you could install System.Speech through NuGet; in the .Net Framework environment, you could go to References->Right click->Add Reference...->Assemblies->Framework->Find System.Speech and reference it.

     

    
    <Grid>
    
                <Label x:Name="MyLabel" HorizontalAlignment="Center" VerticalAlignment="Center" Content="This is a Label" AutomationProperties.Name="{Binding Path=Content,ElementName=MyLabel}"
    
                       Focusable="True" MouseEnter="MyLabel_MouseEnter"  ToolTip="This is a ToolTip" ToolTipOpening="MyLabel_ToolTipOpening">
    
                </Label>
    
    </Grid>
    
    

     

    
    using System.Speech.Synthesis;
    
     
    
            private void MyLabel_MouseEnter(object sender, MouseEventArgs e)
    
            {
    
                MyLabel.Focus();
    
            }
    
     
    
            private void MyLabel_ToolTipOpening(object sender, ToolTipEventArgs e)
    
            {
    
                string text = MyLabel.ToolTip.ToString();
    
                using (SpeechSynthesizer synthesizer = new SpeechSynthesizer())
    
                {
    
                    synthesizer.Speak(text);
    
                }
    
            }
    
    

     

    Run the WPF project and open Narrator by pressing Win+Ctrl+Enter. When you move the mouse to the Label, you could hear the content of the Label.Content. After a while, when the ToolTip is opening, you could hear the content of the ToolTip. I use ToolTipOpening here. You could adjust the time according to your needs.


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Rolle Michel 75 Reputation points
    2024-09-28T01:12:53.8033333+00:00

    Could you specify which version of WPF you're using and the context in which the labels and tooltips are being utilized? This will help in providing a more targeted solution.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.