ThemeableAttribute(Boolean) Konstruktor

Definition

Initierar en ny instans av ThemeableAttribute klassen med det angivna booleska värdet för att avgöra om attributet representerar en typ eller medlem som påverkas av teman och kontrollskinn.

public:
 ThemeableAttribute(bool themeable);
public ThemeableAttribute(bool themeable);
new System.Web.UI.ThemeableAttribute : bool -> System.Web.UI.ThemeableAttribute
Public Sub New (themeable As Boolean)

Parametrar

themeable
Boolean

true för att initiera ThemeableAttribute för att representera en typ eller medlem som kan påverkas av teman, falseannars .

Exempel

Följande kodexempel visar hur du kan tillämpa attributet på ThemeableAttribute en medlem i en kontroll. I det här exemplet ThemeableAttribute tillämpas på en databunden kontroll och false skickas till ThemeableAttribute konstruktorn, vilket anger att DataSourceID medlemmen inte kan använda teman. (Överföring false till konstruktorn resulterar i en ThemeableAttribute instans som motsvarar fältet No .)

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

Kommentarer

Att skicka true till den här konstruktorn motsvarar att använda fältet Yes , medan överföring false motsvarar att använda fältet No .

Gäller för