Style Style Style Style Class

Definition

Warning

This API is now obsolete.

Organizes style characteristics of an ASP.NET mobile control. For information about how to develop ASP.NET mobile applications, see Mobile Apps & Sites with ASP.NET.

public ref class Style : ICloneable, System::Web::UI::IParserAccessor, System::Web::UI::IStateManager, System::Web::UI::MobileControls::ITemplateable
[System.ComponentModel.TypeConverter(typeof(System.ComponentModel.ExpandableObjectConverter))]
[System.Obsolete("The System.Web.Mobile.dll assembly has been deprecated and should no longer be used. For information about how to develop ASP.NET mobile applications, see http://go.microsoft.com/fwlink/?LinkId=157231.")]
public class Style : ICloneable, System.Web.UI.IParserAccessor, System.Web.UI.IStateManager, System.Web.UI.MobileControls.ITemplateable
type Style = class
    interface IParserAccessor
    interface ITemplateable
    interface IStateManager
    interface ICloneable
Public Class Style
Implements ICloneable, IParserAccessor, IStateManager, ITemplateable
Inheritance
StyleStyleStyleStyle
Derived
Attributes
Implements

Examples

The following example demonstrates three user-defined styles in a StyleSheet object. A SelectionList object holds three values that correspond to the three defined styles. The OnClick command event calls the SelectStyle function, which changes the StyleReference property of the TextView object.

<%@ Page Language="C#" 
    Inherits="System.Web.UI.MobileControls.MobilePage" %>
<%@ Register TagPrefix="mobile" 
    Namespace="System.Web.UI.MobileControls" 
    Assembly="System.Web.Mobile" %>

<script runat="server">
    void SelectStyle(object sender, EventArgs e)
    {
        // Retrieve the style name as a string.
        String myStyle = SelectionList1.Selection.ToString();
        // Match the style name and apply the style to TextView1.
        switch (myStyle)
        {
            case "hot":
                TextView1.StyleReference = "Style1";
                break;
            case "medium":
                TextView1.StyleReference = "Style2";
                break;
            case "mild":
                TextView1.StyleReference = "Style3";
                break;
        }
    }
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<body>
<mobile:StyleSheet id="StyleSheet1" runat="server">
    <mobile:Style font-size="Large" font-name="Arial" font-bold="true"
        forecolor="red" font-italic="true" backcolor="#E0E0E0" 
        wrapping="wrap" name="Style1">
    </mobile:Style>
    <mobile:Style font-size="Normal" font-name="Arial" font-bold="false" 
       forecolor="Blue" font-italic="true" backcolor="blue" 
       wrapping="NoWrap" name="Style2">
    </mobile:Style>
    <mobile:Style font-size="Small" font-name="Arial Narrow" 
       font-bold="false" forecolor="Green" font-italic="false" 
       backcolor="Green" wrapping="NoWrap" name="Style3">
    </mobile:Style>
</mobile:StyleSheet>
<mobile:form id="Form1" runat="server">
    <mobile:Label id="Label1" runat="server" Text="Today's Special" 
        StyleReference="title" />
    <mobile:TextView id="TextView1" runat="server" 
        StyleReference="Style1">
        Chili
    </mobile:TextView>
    <mobile:SelectionList runat="server" id="SelectionList1">
        <item Text="hot" Value="hot"/>
        <item Text="medium" Value="medium"/>
        <item Text="mild" Value="mild"/>
    </mobile:SelectionList>
    <mobile:Command runat="server" Text="Select Style" 
        OnClick="SelectStyle" />
    </mobile:form>
</body>
</html>
<%@ Page Language="VB" 
    Inherits="System.Web.UI.MobileControls.MobilePage" %>
<%@ Register TagPrefix="mobile" 
    Namespace="System.Web.UI.MobileControls" 
    Assembly="System.Web.Mobile" %>

<script runat="server">
    Private Sub SelectStyle(ByVal sender As Object, _
        ByVal e As EventArgs)
        
        ' Retrieve the style name as a string
        Dim myStyle As String = SelectionList1.Selection.ToString()
        ' Match the style name and apply the style to TextView1
        Select Case myStyle
            Case "hot"
                TextView1.StyleReference = "Style1"
            Case "medium"
                TextView1.StyleReference = "Style2"
            Case "mild"
                TextView1.StyleReference = "Style3"
        End Select
    End Sub
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<body>
<mobile:StyleSheet id="StyleSheet1" runat="server">
    <mobile:Style font-size="Large" font-name="Arial" font-bold="true"
        forecolor="red" font-italic="true" backcolor="#E0E0E0" 
        wrapping="wrap" name="Style1">
    </mobile:Style>
    <mobile:Style font-size="Normal" font-name="Arial" font-bold="false" 
       forecolor="Blue" font-italic="true" backcolor="blue" 
       wrapping="NoWrap" name="Style2">
    </mobile:Style>
    <mobile:Style font-size="Small" font-name="Arial Narrow" 
       font-bold="false" forecolor="Green" font-italic="false" 
       backcolor="Green" wrapping="NoWrap" name="Style3">
    </mobile:Style>
</mobile:StyleSheet>

<mobile:form id="Form1" runat="server">
    <mobile:Label id="Label1" runat="server" Text="Today's Special" 
        StyleReference="title" />
    <mobile:TextView id="TextView1" runat="server" 
        StyleReference="Style1">
        Chili
    </mobile:TextView>
    <mobile:SelectionList runat="server" id="SelectionList1">
        <item Text="hot" Value="hot"/>
        <item Text="medium" Value="medium"/>
        <item Text="mild" Value="mild"/>
    </mobile:SelectionList>
    <mobile:Command ID="Command1" runat="server" Text="Select Style" 
        OnClick="SelectStyle" />
    </mobile:form>
</body>
</html>

Remarks

The base Style class contains style characteristics common to all mobile controls. Classes that inherit from the Style class contain additional style characteristics specific to their associated control.

Due to the diversity of devices supported by mobile controls, all style properties are advisory, and might or might not be honored depending on the capabilities of the target device.

Constructors

Style() Style() Style() Style()

Initializes a new instance of the Style class. This API is obsolete. For information about how to develop ASP.NET mobile applications, see Mobile Apps & Sites with ASP.NET.

Fields

AlignmentKey AlignmentKey AlignmentKey AlignmentKey

Represents the key used to retrieve the Alignment setting of the Style. This API is obsolete. For information about how to develop ASP.NET mobile applications, see Mobile Apps & Sites with ASP.NET.

BackColorKey BackColorKey BackColorKey BackColorKey

The key for retrieving the style from the embedded style sheet for BackColor property. Used internally by ASP.NET. This API is obsolete. For information about how to develop ASP.NET mobile applications, see Mobile Apps & Sites with ASP.NET.

BoldKey BoldKey BoldKey BoldKey

The key for retrieving the style from the embedded style sheet for setting the Bold property of the Font. Used internally by ASP.NET. This API is obsolete. For information about how to develop ASP.NET mobile applications, see Mobile Apps & Sites with ASP.NET.

FontNameKey FontNameKey FontNameKey FontNameKey

The key for retrieving the style from the embedded style sheet for the Name property of the Font property. Used internally by ASP.NET. This API is obsolete. For information about how to develop ASP.NET mobile applications, see Mobile Apps & Sites with ASP.NET.

FontSizeKey FontSizeKey FontSizeKey FontSizeKey

The key for retrieving the style from the embedded style sheet for the Size property of the Font property. Used internally by ASP.NET. This API is obsolete. For information about how to develop ASP.NET mobile applications, see Mobile Apps & Sites with ASP.NET.

ForeColorKey ForeColorKey ForeColorKey ForeColorKey

The key for retrieving the style from the embedded style sheet for the ForeColor property. Used internally by ASP.NET. This API is obsolete. For information about how to develop ASP.NET mobile applications, see Mobile Apps & Sites with ASP.NET.

ItalicKey ItalicKey ItalicKey ItalicKey

The key for retrieving the style from the embedded style sheet for the Italic property of the Font property. Used internally by ASP.NET. This API is obsolete. For information about how to develop ASP.NET mobile applications, see Mobile Apps & Sites with ASP.NET.

WrappingKey WrappingKey WrappingKey WrappingKey

The key for retrieving the style from the embedded style sheet for Wrapping. Used internally by ASP.NET. This API is obsolete. For information about how to develop ASP.NET mobile applications, see Mobile Apps & Sites with ASP.NET.

Properties

Alignment Alignment Alignment Alignment

Gets or sets the specified alignment for the style. The default value is NotSet. This API is obsolete. For information about how to develop ASP.NET mobile applications, see Mobile Apps & Sites with ASP.NET.

BackColor BackColor BackColor BackColor

Gets or sets the specified background color for the style. The default value is Empty. This API is obsolete. For information about how to develop ASP.NET mobile applications, see Mobile Apps & Sites with ASP.NET.

Control Control Control Control

Returns a strongly typed reference to the associated control. This API is obsolete. For information about how to develop ASP.NET mobile applications, see Mobile Apps & Sites with ASP.NET.

DeviceSpecific DeviceSpecific DeviceSpecific DeviceSpecific

Gets or sets the DeviceSpecific/Choice construct associated with the control. The accessor returns null if no such construct exists. This API is obsolete. For information about how to develop ASP.NET mobile applications, see Mobile Apps & Sites with ASP.NET.

Font Font Font Font

Returns a FontInfo object that contains font information about the control. This API is obsolete. For information about how to develop ASP.NET mobile applications, see Mobile Apps & Sites with ASP.NET.

ForeColor ForeColor ForeColor ForeColor

Gets or sets the specified foreground color for the style. Typically, this property sets the color for the text. The default value is Empty. This API is obsolete. For information about how to develop ASP.NET mobile applications, see Mobile Apps & Sites with ASP.NET.

IsTemplated IsTemplated IsTemplated IsTemplated

Gets a value indicating whether a Style object has an active template set. This API is obsolete. For information about how to develop ASP.NET mobile applications, see Mobile Apps & Sites with ASP.NET.

IsTrackingViewState IsTrackingViewState IsTrackingViewState IsTrackingViewState

Gets a value indicating whether the Style object is saving changes to its view state. This API is obsolete. For information about how to develop ASP.NET mobile applications, see Mobile Apps & Sites with ASP.NET.

Item[Object, Boolean] Item[Object, Boolean] Item[Object, Boolean] Item[Object, Boolean]

Returns the style, through the key parameter, with or without using inheritance. This API is obsolete. For information about how to develop ASP.NET mobile applications, see Mobile Apps & Sites with ASP.NET.

Item[Object] Item[Object] Item[Object] Item[Object]

Returns the style through the key parameter, with or without using inheritance. This API is obsolete. For information about how to develop ASP.NET mobile applications, see Mobile Apps & Sites with ASP.NET.

Name Name Name Name

Gets or sets the name of the specified object. The default value is an empty string (""). This API is obsolete. For information about how to develop ASP.NET mobile applications, see Mobile Apps & Sites with ASP.NET.

State State State State

Gets the current contents of the StateBag. This API is obsolete. For information about how to develop ASP.NET mobile applications, see Mobile Apps & Sites with ASP.NET.

StyleReference StyleReference StyleReference StyleReference

Gets or sets a reference to the style properties for a Style. This API is obsolete. For information about how to develop ASP.NET mobile applications, see Mobile Apps & Sites with ASP.NET.

Wrapping Wrapping Wrapping Wrapping

Gets or sets the specified wrapping mode for the style. The default value is NotSet. This API is obsolete. For information about how to develop ASP.NET mobile applications, see Mobile Apps & Sites with ASP.NET.

Methods

AddParsedSubObject(Object) AddParsedSubObject(Object) AddParsedSubObject(Object) AddParsedSubObject(Object)

Sets the DeviceSpecific property to the specified object. This API is obsolete. For information about how to develop ASP.NET mobile applications, see Mobile Apps & Sites with ASP.NET.

ApplyTo(WebControl) ApplyTo(WebControl) ApplyTo(WebControl) ApplyTo(WebControl)

Applies the properties of a style to a control. This API is obsolete. For information about how to develop ASP.NET mobile applications, see Mobile Apps & Sites with ASP.NET.

Clone() Clone() Clone() Clone()

Returns a copy of this instance of the Style object. This API is obsolete. For information about how to develop ASP.NET mobile applications, see Mobile Apps & Sites with ASP.NET.

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode() GetHashCode() GetHashCode() GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetTemplate(String) GetTemplate(String) GetTemplate(String) GetTemplate(String)

Returns the template with the specified name. This API is obsolete. For information about how to develop ASP.NET mobile applications, see Mobile Apps & Sites with ASP.NET.

GetType() GetType() GetType() GetType()

Gets the Type of the current instance.

(Inherited from Object)
LoadViewState(Object) LoadViewState(Object) LoadViewState(Object) LoadViewState(Object)

Loads the view state into the State of the Style object. This API is obsolete. For information about how to develop ASP.NET mobile applications, see Mobile Apps & Sites with ASP.NET.

MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
RegisterStyle(String, Type, Object, Boolean) RegisterStyle(String, Type, Object, Boolean) RegisterStyle(String, Type, Object, Boolean) RegisterStyle(String, Type, Object, Boolean)

Registers a style property and returns a unique key for lookup. This API is obsolete. For information about how to develop ASP.NET mobile applications, see Mobile Apps & Sites with ASP.NET.

SaveViewState() SaveViewState() SaveViewState() SaveViewState()

Saves the changes to the view state to an Object. This API is obsolete. For information about how to develop ASP.NET mobile applications, see Mobile Apps & Sites with ASP.NET.

ToString() ToString() ToString() ToString()

Returns a string that represents the current object.

(Inherited from Object)
TrackViewState() TrackViewState() TrackViewState() TrackViewState()

Turns on the tracking of view state in the Style object. This API is obsolete. For information about how to develop ASP.NET mobile applications, see Mobile Apps & Sites with ASP.NET.

Explicit Interface Implementations

IParserAccessor.AddParsedSubObject(Object) IParserAccessor.AddParsedSubObject(Object) IParserAccessor.AddParsedSubObject(Object) IParserAccessor.AddParsedSubObject(Object)

For a description of this member, see AddParsedSubObject(Object). This API is obsolete. For information about how to develop ASP.NET mobile applications, see Mobile Apps & Sites with ASP.NET.

IStateManager.IsTrackingViewState IStateManager.IsTrackingViewState IStateManager.IsTrackingViewState IStateManager.IsTrackingViewState

For a description of this member, see IsTrackingViewState. This API is obsolete. For information about how to develop ASP.NET mobile applications, see Mobile Apps & Sites with ASP.NET.

IStateManager.LoadViewState(Object) IStateManager.LoadViewState(Object) IStateManager.LoadViewState(Object) IStateManager.LoadViewState(Object)

For a description of this member, see LoadViewState(Object). This API is obsolete. For information about how to develop ASP.NET mobile applications, see Mobile Apps & Sites with ASP.NET.

IStateManager.SaveViewState() IStateManager.SaveViewState() IStateManager.SaveViewState() IStateManager.SaveViewState()

For a description of this member, see SaveViewState(). This API is obsolete. For information about how to develop ASP.NET mobile applications, see Mobile Apps & Sites with ASP.NET.

IStateManager.TrackViewState() IStateManager.TrackViewState() IStateManager.TrackViewState() IStateManager.TrackViewState()

For a description of this member, see TrackViewState(). This API is obsolete. For information about how to develop ASP.NET mobile applications, see Mobile Apps & Sites with ASP.NET.

Security

AspNetHostingPermission
for operating in a hosted environment. Demand value: InheritanceDemand; Permission value: Minimal.

Applies to

See also