Supporting ScreenReaders in Silverlight


Url: http://wilderminds.blob.core.windows.net/downloads/accessiblesilve...

Silverlight Logo

While teaching a Silverlight class on campus last week, I had a chance to get a coffee at a cafe on campus and ran into someone who works on the Windows build team. I noticed that he was blind because he was asking the barista to help him figure out whether his money was a $1, $5 or $10 bill. Of course, the fact that US Currency is same sized has always baffled me since the rest of the world uses different sizes to combat this very problem...but I digress.

While we were waiting for our coffee, he asked me about how Silverlight works with ScreenReaders. I've read the docs so I knew that it worked, but I'd never tried it out. It occurred to me that since Silverlight supports screenreaders (and has since at least Silverlight 2).  While the screenreaders do an admirable job without help, Silverlight provides the hooks required to improve the description of controls on your applications. 

In Silverlight, to add helpful text that describes controls, you can simple use the AutomationProperties attached properties.  AutomationProperties.Name and AutomationProperties.HelpText are the most important for screenreaders.  For example, here is a simple piece of XAML with the AutomationProperties set:

<Button Content="<<"
        Margin="2"
        Width="45"
        AutomationProperties.Name="First Game"
        AutomationProperties.HelpText="Moves to the first XBox Game."
        x:Name="firstButton" />
<Button Content="<"
        Margin="2"
        Width="45"
        AutomationProperties.Name="Previous Game"
        AutomationProperties.HelpText="Moves to the previous XBox Game."
        x:Name="prevButton" />
<Button Content=">"
        Margin="2"
        Width="45"
        AutomationProperties.Name="Next Game"
        AutomationProperties.HelpText="Moves to the next XBox Game."
        x:Name="nextButton" />
<Button Content=">>"
        Margin="2"
        Width="45"
        AutomationProperties.Name="Last Game"
        AutomationProperties.HelpText="Moves to the last XBox Game."
        x:Name="lastButton" />
</StackPanel>
<TextBlock Text="Name" />
<TextBox Text="{Binding ProductName}"
         AutomationProperties.Name="XBox Game Title"
         AutomationProperties.HelpText="The Name of the XBox Game" />

 

With these properties in place, the screenreaders can do a better job.  You can see it working here:

Get Microsoft Silverlight

Are you doing anything about making your Silverlight applications accessible?



Shawn
Shawn Wildermuth
Author, Teacher, and Coach




My Courses

Wilder Minds Training
Vue.js by Example (New Lower Price)
Bootstrap 4 by Example (New Lower Price)
Intro to Font Awesome 5 (Free Course)
Pluralsight
Building an API with ASP.NET Core (New Course)
Building a Web App with ASP.NET Core, MVC6, EF Core, Bootstrap and Angular (updated for 2.2)
Less: Getting Started (New)
Using Visual Studio Code for ASP.NET Core Projects
Implementing ASP.NET Web API

Application Name WilderBlog Environment Name Production
Application Ver v4.0.30319 Runtime Framework x86
App Path D:\home\site\wwwroot\ Runtime Version .NET Core 4.6.27817.01
Operating System Microsoft Windows 10.0.14393 Runtime Arch X86