ThemeableAttribute Class
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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.
public ref class ThemeableAttribute sealed : Attribute
[System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Property)]
public sealed class ThemeableAttribute : Attribute
[<System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Property)>]
type ThemeableAttribute = class
inherit Attribute
Public NotInheritable Class ThemeableAttribute
Inherits Attribute
- Inheritance
- Attributes
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;
}
}
}
}
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
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.
Themeable |
Initializes 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. |
Default |
Gets a ThemeableAttribute instance that represents the application-defined default value of the attribute. |
No |
Gets a ThemeableAttribute instance used to decorate a type or member that is not affected by themes and control skins. |
Yes |
Gets a ThemeableAttribute instance used to decorate a type or member that is affected by themes and control skins. |
Themeable |
Gets 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. |
Type |
When implemented in a derived class, gets a unique identifier for this Attribute. (Inherited from Attribute) |
Equals(Object) |
Returns a value that indicates whether this instance is equal to a specified object. |
Get |
Serves as a hash function for the ThemeableAttribute type. |
Get |
Gets the Type of the current instance. (Inherited from Object) |
Is |
Gets a value indicating whether the current instance is equivalent to a Default instance of the ThemeableAttribute class. |
Is |
Returns a value indicating whether the object passed to the method supports themes. |
Is |
Returns a value indicating whether the Type passed to the method supports themes. |
Match(Object) |
When overridden in a derived class, returns a value that indicates whether this instance equals a specified object. (Inherited from Attribute) |
Memberwise |
Creates a shallow copy of the current Object. (Inherited from Object) |
To |
Returns a string that represents the current object. (Inherited from Object) |
_Attribute. |
Maps a set of names to a corresponding set of dispatch identifiers. (Inherited from Attribute) |
_Attribute. |
Retrieves the type information for an object, which can be used to get the type information for an interface. (Inherited from Attribute) |
_Attribute. |
Retrieves the number of type information interfaces that an object provides (either 0 or 1). (Inherited from Attribute) |
_Attribute. |
Provides access to properties and methods exposed by an object. (Inherited from Attribute) |
Product | Versies |
---|---|
.NET Framework | 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
Feedback over .NET
.NET is een opensourceproject. Selecteer een koppeling om feedback te geven: