ThemeableAttribute(Boolean) Konstruktor

Definicja

Inicjuje ThemeableAttribute nowe wystąpienie klasy przy użyciu określonej wartości logicznej w celu określenia, czy atrybut reprezentuje typ lub element członkowski, którego dotyczy motywy i skóry sterowania.

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

Parametry

themeable
Boolean

true w celu zainicjowania ThemeableAttribute elementu reprezentującego typ lub element członkowski, którego może dotyczyć motywy; w przeciwnym razie false.

Przykłady

Poniższy przykład kodu pokazuje, jak można zastosować ThemeableAttribute atrybut do elementu członkowskiego kontrolki. W tym przykładzie ThemeableAttribute jest stosowany do kontrolki powiązanej z danymi i false jest przekazywany do ThemeableAttribute konstruktora, co oznacza, że element DataSourceID członkowski nie może mieć zastosowanych motywów. (Przekazywanie false do konstruktora powoduje ThemeableAttribute wystąpienie, które jest równoważne z polem 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

Uwagi

Przekazywanie true do tego konstruktora jest równoważne użyciu Yes pola, podczas gdy przekazywanie false jest równoważne użyciu No pola.

Dotyczy