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有选择地将主题应用到父控件中包含的子控件。控件.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.