Styles Control Pattern

Describes guidelines and conventions for implementing IStylesProvider, including information about properties and methods. The Styles control pattern is used to describe a UI element that has a specific style, fill color, fill pattern, or shape.

The Styles control pattern is especially useful for describing elements in a document, which frequently have such styles. Styles typically carry information that is useful for customers with disabilities; for example, a style can describe a certain string as the title of a document, or a certain flowchart object as a diamond or a circle. For examples of controls that implement this control pattern, see Control Types and Their Supported Control Patterns.

This topic contains the following sections.

Implementation Guidelines and Conventions

When implementing the Styles control pattern, note the following guidelines and conventions:

  • The UIAutomationClient.h header file defines a set of named constant values used to identify several common styles. For more information, see Style Identifiers.
  • If you use StyleId_Custom, you must implement the IStylesProvider::StyleName property to enable clients to discover the name of the style. You do not need to implement the StyleName property for a standard style because Microsoft UI Automation provides a default name, but you can implement it if you need to override the default name.
  • The other properties in the Styles pattern are optional; the provider can return UIA_E_NOTSUPPORTED for a property that is not supported.
  • Styles in a text range can be represented through the following text attributes:
    • When responding to a request for the StyleId text attribute, the text range should return one of the style identifiers described in Style Identifiers.
    • If StyleId_Custom is used, the text range should return a string value for the StyleName text attribute to enable clients to discover the style name.
    • A text range that has multiple styles, such as both heading and normal text, should return the special UI Automation ReservedMixedAttributeValue property for both the StyleId and StyleName properties. A client receiving this response can subdivide the text range to find where the styles begin and end.
  • Applications can use a wide variety of styles to describe objects, but UI Automation represents only the most common ones. To represent additional style attributes, such as border color, a provider can return a list of additional attributes in the ExtendedProperties property. This is basically a property bag with a set of extended properties, such as "BorderColor=0xFF0000;BorderStyle=dotted". The values of extended properties can be application-specific.

Required Members for IStylesProvider

The following properties are required for implementing the IStylesProvider interface.

Required membersMember typeNotes
ExtendedProperties PropertyNone
FillColor PropertyNone
FillPatternColor PropertyNone
FillPatternStyle PropertyNone
Shape PropertyNone
StyleId PropertyNone
StyleName PropertyNone

 

This control pattern has no associated methods or events.

Related topics

Control Types and Their Supported Control Patterns
UI Automation Control Patterns Overview
UI Automation Tree Overview

 

 

Community Additions

ADD
Show:
© 2014 Microsoft