次の方法で共有


SystemParameters.HighContrast Property

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Gets a value that indicates whether the client computer is in high-contrast mode.

Namespace:  System.Windows
Assembly:  System.Windows (in System.Windows.dll)

Syntax

'Declaration
Public Shared ReadOnly Property HighContrast As Boolean
public static bool HighContrast { get; }

Property Value

Type: System.Boolean
true if the client computer is in high-contrast mode; otherwise, false.

Remarks

You can check this property to determine whether the application is running on a computer that is in high contrast mode. If the computer is in high-contrast mode, you should do the following:

  • Convey information by UI design techniques other than color. For example, if highlighted items in a list have red foreground, you can add a cue that does not rely on color, such as making the font of the highlighted items bold, or adding an icon or symbol to the text.

  • Omit patterns and images behind text.

On computers that run Windows, the HighContrast property is true when the user has enabled High Contrast in Control Panel. On Macintosh computers, HighContrast is true when the user has selected the White on Black option in Universal Access.

Some techniques that may be useful for creating high contrast UI include the following:

  • Set colors of elements within your UI by using brush resource elements in a ResourceDictionary. If a change in HighContrast occurs, you can use one of several techniques to change the value of the resource. For example, you can change the resource itself programmatically, or you can introduce a resource that has the same key and overrides the previous brush resource in lookup sequence.

  • By resetting the Template property, you can load a complete control theme template that is designed for high contrast, including changing background brushes, border sizes, text colors and so on.

Version Information

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.