Export (0) Print
Expand All

ThemeableAttribute Class

Defines the metadata attribute that Web server controls and their members use to indicate whether their rendering can be affected by themes and control skins. This class cannot be inherited.

System.Object
  System.Attribute
    System.Web.UI.ThemeableAttribute

Namespace:  System.Web.UI
Assembly:  System.Web (in System.Web.dll)

[AttributeUsageAttribute(AttributeTargets.Class|AttributeTargets.Property)]
public sealed class ThemeableAttribute : Attribute

The ThemeableAttribute type exposes the following members.

  NameDescription
Public methodThemeableAttributeInitializes a new instance of the ThemeableAttribute class, using the specified Boolean value to determine whether the attribute represents a type or member that is affected by themes and control skins.
Top

  NameDescription
Public propertyThemeableGets a value indicating whether the current control or member of a control can be affected by themes and control skins defined for the Web application.
Public propertyTypeIdWhen implemented in a derived class, gets a unique identifier for this Attribute. (Inherited from Attribute.)
Top

  NameDescription
Public methodEqualsReturns a value that indicates whether this instance is equal to a specified object. (Overrides Attribute.Equals(Object).)
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public methodGetHashCodeServes as a hash function for the ThemeableAttribute type. (Overrides Attribute.GetHashCode().)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Public methodIsDefaultAttributeGets a value indicating whether the current instance is equivalent to a Default instance of the ThemeableAttribute class. (Overrides Attribute.IsDefaultAttribute().)
Public methodStatic memberIsObjectThemeableReturns a value indicating whether the object passed to the method supports themes.
Public methodStatic memberIsTypeThemeableReturns a value indicating whether the Type passed to the method supports themes.
Public methodMatchWhen overridden in a derived class, returns a value that indicates whether this instance equals a specified object. (Inherited from Attribute.)
Protected methodMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)
Top

  NameDescription
Public fieldStatic memberDefaultGets a ThemeableAttribute instance that represents the application-defined default value of the attribute.
Public fieldStatic memberNoGets a ThemeableAttribute instance used to decorate a type or member that is not affected by themes and control skins.
Public fieldStatic memberYesGets a ThemeableAttribute instance used to decorate a type or member that is affected by themes and control skins.
Top

  NameDescription
Explicit interface implemetationPrivate method_Attribute.GetIDsOfNamesMaps a set of names to a corresponding set of dispatch identifiers. (Inherited from Attribute.)
Explicit interface implemetationPrivate method_Attribute.GetTypeInfoRetrieves the type information for an object, which can be used to get the type information for an interface. (Inherited from Attribute.)
Explicit interface implemetationPrivate method_Attribute.GetTypeInfoCountRetrieves the number of type information interfaces that an object provides (either 0 or 1). (Inherited from Attribute.)
Explicit interface implemetationPrivate method_Attribute.InvokeProvides access to properties and methods exposed by an object. (Inherited from Attribute.)
Top

Control developers use the ThemeableAttribute attribute to decorate control types and their members, to signal which ones can and cannot be affected by themes and control skins. By default, all properties exposed by a control are themeable. However, themes are typically applied only to stylistic properties; the Themeable(false) attribute should be applied explicitly to all non-stylistic properties. Decorating a member with the Themeable(false) attribute ensures that the member is not themed, regardless of the value of the EnableTheming property. For example, if the ThemeableAttribute attribute is applied to a control and set to false, the control is not affected by themes even when its EnableTheming property is set to true.

The ThemeableAttribute class maintains a static list of all types that support themes, and this list is consulted whenever the static methods IsObjectThemeable and IsTypeThemeable are called.

The following code example demonstrates how you can apply the ThemeableAttribute attribute to a member of a control. In this example, ThemeableAttribute is applied to a data-bound control and false is passed to the ThemeableAttribute constructor, indicating that the DataSourceID member cannot have themes applied. (Passing false to the constructor results in a ThemeableAttribute instance that is equivalent to the No field.)


namespace Samples.AspNet.CS.Controls {
    using System;
    using System.Web.UI;
    using System.Web.UI.WebControls;


    public class SomeDataBoundControl : DataBoundControl
    {
        // Implementation of a custom data source control.

        [Themeable(false) ]
        [IDReferenceProperty()]
        public override string DataSourceID {
            get {
                return base.DataSourceID;
            }
            set {
                base.DataSourceID = value;
            }
        }

    }
}


.NET Framework

Supported in: 4, 3.5, 3.0, 2.0

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Community Additions

ADD
Show:
© 2014 Microsoft