ThemeableAttribute(Boolean) 建構函式

定義

初始化該類別的新實例 ThemeableAttribute ,使用指定的布林值判斷該屬性是否代表受主題與控制表皮影響的類型或成員。

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

參數

themeable
Boolean

true 初始化 以 ThemeableAttribute 表示可受主題影響的類型或成員;否則, false

範例

以下程式碼範例示範如何將屬性 ThemeableAttribute 套用到控制項的成員上。 在此範例中, ThemeableAttribute 被套用到資料綁定控制項,並 false 傳給 ThemeableAttribute 建構子,表示 DataSourceID 該成員無法套用主題。 (將運算權傳遞 false 到建構子後,會得到 ThemeableAttribute 一個等價於該 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

備註

傳遞 true 到這個建構子等同於使用 Yes 該場,而傳遞 false 則等同於使用 No 該場。

適用於