WebControl.EnableTheming WebControl.EnableTheming WebControl.EnableTheming WebControl.EnableTheming Property


取得或設定值,指出佈景主題是否套用至此控制項。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. 當屬性為true時,會搜尋應用程式的主題目錄,以取得要套用的控制台。 EnableThemingWhen 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.

當屬性為false時,不會搜尋主題目錄, SkinID也不會使用屬性的內容。 EnableThemingWhen 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 ,以選擇性地將主題套用至包含在父系中的子控制項。controls.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.