WebControl.EnableTheming 屬性


取得或設定值,指出佈景主題是否套用至此控制項。Gets or sets a value indicating whether themes apply to this control.

 virtual property bool EnableTheming { bool get(); void set(bool value); };
public override bool EnableTheming { get; set; }
member this.EnableTheming : bool with get, set
Public Overrides Property EnableTheming As Boolean



true 表示使用主題,否則為 falsetrue to use themes; otherwise, false. 預設為 trueThe default is true.



EnableTheming屬性會指出是否已針對指定的控制項啟用主題。The EnableTheming property indicates whether themes are enabled for a specified control. EnableTheming 屬性為時 true ,會搜尋應用程式的主題目錄,以套用控制項的外觀。When the EnableTheming property is true, the theme directory for the application is searched for control skins to apply. 如果主題目錄中沒有特定控制項的面板,則不會套用外觀。If no skin for the particular control exists in the theme directory, skins are not applied.

EnableTheming 屬性為時 false ,不會搜尋主題目錄,也 SkinID 不會使用屬性的內容。When the EnableTheming property is false, the theme directory is not searched and the contents of the SkinID property is not used.

控制項可以覆寫 EnableTheming 其父控制項或包含頁面所設定的值。A control can override the EnableTheming value set by its parent control or the containing page. 例如,如果父控制項的 EnableTheming 屬性設定為 false ,您可以 EnableTheming true 在個別子控制項上,將屬性設定為,以選擇性地將主題套用至父系中包含的子控制項。For example, if a parent control has the EnableTheming property set to false, you can selectively apply themes to child controls that are contained within the parent by setting the EnableTheming property to true on the individual child controls.

您可以在頁面、容器或控制項層級啟用主題。Themes can be enabled at the page, container, or control level. 在頁面或容器層級停用主題時,會針對頁面或容器所包含的所有控制項停用主題。When theming is disabled at the page or container level, themes are disabled for all controls that are contained by the page or container.