How to: Add and Configure a StyleSheet Control

Use the StyleSheet control control to define style information. A StyleSheet control must be placed either directly on an ASP.NET mobile Web page or in a mobile user control. A mobile Web page or mobile user control can have only one StyleSheet control. StyleSheet controls can contain one or more styles to be applied to other controls.

To add a StyleSheet control and create a style

  1. In Design view, drag a StyleSheet control from theMobile Web Forms tab of the Toolbox onto a mobile Web Forms page. You can also drag it onto a mobile user control page.

  2. Select Edit Styles from the shortcut menu.

    The Styles Editor dialog box is displayed.

  3. In the Style Types list, click Style Type.

  4. Click the Add button (>) to add an instance of that style type to the Defined Styles list.

  5. In the Properties list, set individual properties for the new style.

To derive a new style from an existing style

  1. In Design view, right-click the StyleSheet control, click Show Smart Tag, and then click Edit Styles.

  2. The Styles Editor dialog box is displayed.

  3. In the Defined Styles list, locate the style type to derive from. (If it is not there, use the preceding procedure to add it.)

  4. To create the derived style, select the base style in the Style Types list and then click Add.

  5. Type the name of the base style in the StyleReference property, or select it from the drop-down list next to the StyleReference property.

    This derives the new style from the previous style.

  6. In the Properties list, set the individual properties for the derived style that you want to make different from the original style.

To rename an existing style

  1. In Design view, right-click the StyleSheet control, click Smart Tag, and then click Edit Styles.

    The Styles Editor dialog box is displayed.

  2. In the Defined Styles list, select the style whose name you want to change.

  3. Press F2, and then type a new name for the style.

  4. Click OK.

    Note

    If you rename a style, Visual Studio does not update references to that style name. All controls whose StyleReference property refers to the old name must be changed manually.

To edit the templates for a style

  1. In Design view, click the StyleSheet control.

  2. In the Properties window, select the TemplateStyle item, and then select a style from the list.

  3. In the Properties window, select the TemplateDeviceFilter item and then select a device filter from the list. (If no device filters appear in the list, select Templating Options from the shortcut menu and add them. For details, see Applying Device Filters.)

  4. Right-click the style sheet and then on the shortcut menu, click Edit Templates.

  5. Select the template that you want to edit.

See Also

Reference

StyleSheet

Style

PagerStyle

Concepts

Introduction to the StyleSheet Control