WebControl.EnableTheming 属性

定义

获取或设置一个值,该值指示主题是否应用于该控件。Gets or sets a value indicating whether themes apply to this control.

public:
 virtual property bool EnableTheming { bool get(); void set(bool value); };
[System.ComponentModel.Browsable(true)]
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. trueEnableTheming 属性时,将在应用程序的主题目录中搜索要应用的控件外观。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.

falseEnableTheming 属性时,不会搜索主题目录,并且不使用 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.

适用于

另请参阅