Creating New StylesÂ
For most ASP.NET mobile controls, the methods and properties that are available in the Style base class are sufficient to render the style you want on most devices. However, some styles such as alignment, font, or color, might not always render properly on some wireless devices.
All mobile controls have an associated style object that contains style properties directly defined for the control. The style object must be an instance of a class that inherits from the Style class.
The style object is defined as a protected field of the MobileControl base class, and is thus hidden from the page developer. However, for each property of a Style object, the associated control class also exposes a public property that you, as a page developer, can access by reading or writing to it. For example, the MobileControl base class exposes all of the properties of the Style base class as its own.
In addition, styles follow an inheritance model. At rendering time, control adapters can retrieve style information that includes inherited values by using a special indexer on the style.
In This Section
- Accessing Style Properties in Device Adapters
Describes how to access style inheritance behavior for device adapters.
- Walkthrough: Implementing a New Style
Walks you through the process of creating a specialized style.
Related Sections
- Styles
Discusses style from a rendering perspective: style sheet capabilities, organizational considerations, and the use of the <style> element.
- <Style> Element
Explains how style characteristics of a mobile control are organized.