User Agent and Assistive Technology Support Notes

Description

The objective of this technique is to incorporate high contrast color
choices into a user interface visual design for Silverlight, by changing
the values of styles or templates, or changing values of individual
resources such as brushes or colors.

Silverlight styles and templates are produced in XAML. Silverlight
event handlers (such as the ones that engage the style switch) are
written in code, but are often wired through a method name reference
in the XAML. For more information on how to use templates, styles and
resources to change the appearance of Silverlight controls, see Control
Customization topic on MSDN.

Silverlight provides a built-in property that can determine whether
the hosting operating system is using a high contrast theme. This is
a Boolean value only; Silverlight API cannot determine any further
specifics about the theme choice, such as the colors being used or
the contrast ratio between the colors. Querying this property at application
startup is one possible trigger mechanism for applying high contrast
themes to Silverlight content. Another mechanism is to expose a control
(such as a button or text link) to the user, so that the user can engage
high contrast for a Silverlight application's content by activating
a control within the Silverlight application.

Silverlight Toolkit themes and System Colors

An extension to the Silverlight core deliverables known as the Silverlight
Toolkit provides theming APIs and various themed styles for Silverlight
controls, including the core controls. Most of these themes are intended
for design purposes, but the Silverlight Toolkit also provides a System
Colors theme. The System Colors theme aligns the Silverlight theme
brushes or colors with those of the settings applied to the Microsoft
Windows operating system display options. When the user switches the
system themes to use a theme that is typically used for high contrast,
the underlying system brushes are redefined. A Silverlight application
that uses the System Colors theme also uses the now-redefined colors
in its UI, and will effectively use the same High Contrast colors that
are user-selected for all other display. How to use the Silverlight
Toolkit system themes is not described in this technique. However,
the Silverlight Toolkit theme system is a viable option for providing
high contrast as well as other more aesthetics-oriented UI experiences.
For more information about the Silverlight Toolkit, see Toolkit
site. The themes feature of Silverlight Toolkit is best explained
by Silverlight
Toolkit release notes (from a Microsoft-related blog).

Real-time changes not supported

SystemParameters.HighContrast is an adequate trigger
for cases where high contrast is already engaged before the Silverlight
plugin is loaded into a host. However, a limitation of using SystemParameters.HighContrast as
a trigger mechanism is that Silverlight does not detect the change
if it happens after the Silverlight plugin is loaded by the host HTML.
If Silverlight authors want to support real-time changes, they should provide a user-initiated
control option for changing to high contrast in Silverlight UI rather
than solely relying on SystemParameters.HighContrast.

Examples

Example 1: Silverlight application designed with brush resources
and template resources that enable a high contrast switch

The example "application" for illustration is just text,
a button and border. The concepts shown in the example can scale to
any complexity of UI, including to applications that have thousands
of lines of XAML. Note that the visual appearance of the button is
already using a high contrast theme choice for its default state, to
assure that the control is visible to anyone that requires a high contrast
theme to see parts of the user interface per G174.
To keep the example simple, the visual states (behaviors) associated
with mouse-over, click, etc. have not been restyled for high contrast.
Only the base appearance is changed. The example also shows a technique
of storing original theme information and restoring it in response
to user request.

Example 2: Use SystemParameters.HighContrast to detect system high
contrast settings at application startup

This example uses the same UI and style definitions as the previous
example. The sole addition a case statement that is added to the primary
page constructor of the UI (defined in C#). The added code is everything
other than the InitializeComponent() call (which is part of Silverlight
infrastructure). Note that the added code calls a user-defined function
ChangeToHighCon(), which is the same function and behavior as shown
in Example 1 for the user-initiated high contrast switch.

Expected Results

#3 is true.

If this is a sufficient technique for a success criterion, failing this test procedure does not necessarily mean that the success criterion has not been satisfied in some other way, only that this technique has not been successfully implemented and can not be used to claim conformance.

Tests

HighContrast API

Procedure

To test the HighContrast API (Example 2):

Use operating system settings (such as Ctrl+LeftShift+PrtScn shortcut
on Windows 7) to enter high contrast mode prior to opening the test
page.

Using a browser that supports Silverlight, open an HTML page that
references a Silverlight application through an object tag.

Expected Results

#3 is true.

If this is a sufficient technique for a success criterion, failing this test procedure does not necessarily mean that the success criterion has not been satisfied in some other way, only that this technique has not been successfully implemented and can not be used to claim conformance.

Tests

UI option for enhanced contrast

Procedure

To test a Silverlight UI option for style switching for enhanced contrast:

Using a browser that supports Silverlight, open an HTML page that
references a Silverlight application through an object tag.

Check for a control that indicates it will change the application's
appearance to use an enhanced contrast theme.

Expected Results

#3 is true.

If this is a sufficient technique for a success criterion, failing this test procedure does not necessarily mean that the success criterion has not been satisfied in some other way, only that this technique has not been successfully implemented and can not be used to claim conformance.