.NET Framework Class Library
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.

Inheritance Hierarchy
SystemObject
   SystemAttribute
    System.Web.UIThemeableAttribute

Namespace:   System.Web.UI
Assembly:  System.Web (in System.Web.dll)
Syntax
<[%$TOPIC/z15ats12_en-us_VS_110_2_0_0_0_0%]([%$TOPIC/z15ats12_en-us_VS_110_2_0_0_0_1%].Class Or [%$TOPIC/z15ats12_en-us_VS_110_2_0_0_0_2%].Property)> _
Public NotInheritable Class ThemeableAttribute _
	Inherits [%$TOPIC/z15ats12_en-us_VS_110_2_0_0_0_3%]
[[%$TOPIC/z15ats12_en-us_VS_110_2_0_1_0_0%]([%$TOPIC/z15ats12_en-us_VS_110_2_0_1_0_1%].Class|[%$TOPIC/z15ats12_en-us_VS_110_2_0_1_0_2%].Property)]
public sealed class ThemeableAttribute : [%$TOPIC/z15ats12_en-us_VS_110_2_0_1_0_3%]
[[%$TOPIC/z15ats12_en-us_VS_110_2_0_2_0_0%]([%$TOPIC/z15ats12_en-us_VS_110_2_0_2_0_1%]::Class|[%$TOPIC/z15ats12_en-us_VS_110_2_0_2_0_2%]::Property)]
public ref class ThemeableAttribute sealed : public [%$TOPIC/z15ats12_en-us_VS_110_2_0_2_0_3%]
[<[%$TOPIC/z15ats12_en-us_VS_110_2_0_3_0_0%]>]
[<[%$TOPIC/z15ats12_en-us_VS_110_2_0_3_0_1%]([%$TOPIC/z15ats12_en-us_VS_110_2_0_3_0_2%].Class|[%$TOPIC/z15ats12_en-us_VS_110_2_0_3_0_3%].Property)>]
type ThemeableAttribute =  
    class 
        inherit [%$TOPIC/z15ats12_en-us_VS_110_2_0_3_0_4%] 
    end
public final class ThemeableAttribute extends [%$TOPIC/z15ats12_en-us_VS_110_2_0_4_0_0%]

The ThemeableAttribute type exposes the following members.

Constructors
  NameDescription
Public method ThemeableAttributeInitializes 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
Properties
  NameDescription
Public property ThemeableGets 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 property TypeIdWhen implemented in a derived class, gets a unique identifier for this Attribute. (Inherited from Attribute.)
Top
Methods
  NameDescription
Public method EqualsReturns a value that indicates whether this instance is equal to a specified object. (Overrides AttributeEquals(Object).)
Public method GetHashCodeServes as a hash function for the ThemeableAttribute type. (Overrides AttributeGetHashCode.)
Public method GetTypeGets the Type of the current instance. (Inherited from Object.)
Public method IsDefaultAttributeGets a value indicating whether the current instance is equivalent to a Default instance of the ThemeableAttribute class. (Overrides AttributeIsDefaultAttribute.)
Public method Static member IsObjectThemeableReturns a value indicating whether the object passed to the method supports themes.
Public method Static member IsTypeThemeableReturns a value indicating whether the Type passed to the method supports themes.
Public method MatchWhen overridden in a derived class, returns a value that indicates whether this instance equals a specified object. (Inherited from Attribute.)
Public method ToStringReturns a string that represents the current object. (Inherited from Object.)
Top
Fields
  NameDescription
Public field Static member DefaultGets a ThemeableAttribute instance that represents the application-defined default value of the attribute.
Public field Static member NoGets a ThemeableAttribute instance used to decorate a type or member that is not affected by themes and control skins.
Public field Static member YesGets a ThemeableAttribute instance used to decorate a type or member that is affected by themes and control skins.
Top
Explicit Interface Implementations
  NameDescription
Explicit interface implemetation Private method _AttributeGetIDsOfNamesMaps a set of names to a corresponding set of dispatch identifiers. (Inherited from Attribute.)
Explicit interface implemetation Private method _AttributeGetTypeInfoRetrieves the type information for an object, which can be used to get the type information for an interface. (Inherited from Attribute.)
Explicit interface implemetation Private method _AttributeGetTypeInfoCountRetrieves the number of type information interfaces that an object provides (either 0 or 1). (Inherited from Attribute.)
Explicit interface implemetation Private method _AttributeInvokeProvides access to properties and methods exposed by an object. (Inherited from Attribute.)
Top
Remarks

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.

Examples

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.)

Imports System
Imports System.Web.UI
Imports System.Web.UI.WebControls

Public Class SomeDataBoundControl
    Inherits DataBoundControl

    ' Implementation of a custom data source control.

    <Themeable(False)> _
    <IDReferenceProperty()>  _
    Public Overrides Property DataSourceID() As String  
        Get 
            Return MyBase.DataSourceID
        End Get 
        Set 
            MyBase.DataSourceID = value
        End Set 
    End Property 

End Class 'SomeDataBoundControl 
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;
            }
        }

    }
}
Version Information

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0
Thread Safety
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.