FrameworkElement.OverridesDefaultStyle 属性

定义

获取或设置一个值,该值指示此元素是否并入主题样式中的样式属性。Gets or sets a value that indicates whether this element incorporates style properties from theme styles.

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

属性值

Boolean

如果此元素不使用主题样式属性,则为 true;所有源于样式的属性均来自本地应用程序样式,不会应用主题样式属性。true if this element does not use theme style properties; all style-originating properties come from local application styles, and theme style properties do not apply. 如果首先应用了应用程序样式,然后将主题样式应用于未在应用程序样式中专门设置的属性,则为 falsefalse if application styles apply first, and then theme styles apply for properties that were not specifically set in application styles. 默认为 falseThe default is false.

注解

此属性最常见的用法是在提供主题样式的样式的资源库中间接使用。The most common usage of this property is an indirect usage within the setter of a style that is supplying a themed style.

重要

如果将 OverridesDefaultStyle 设置为在控件上 true,则将禁止主题样式提供的默认控件模板。If you set OverridesDefaultStyle to true on a control, you will be suppressing the default control template supplied by the theme styles. 该控件模板通常包括内容呈现器和其他为控件提供基本 UIUI 功能和可视化的复合元素。That control template typically includes the content presenter and other composited elements that provide basic UIUI functionality and visualization for the control. 如果希望控件继续支持与默认主题样式相同的功能,则必须使用复制相同结构的控件模板提供替换样式。If you want the control to continue to support the same features as the default theme styles, you must supply an alternate style with a control template that replicates the same structure. 有关详细信息,请参阅控件创作概述For more information, see Control Authoring Overview.

依赖项属性信息Dependency Property Information

标识符字段Identifier field OverridesDefaultStyleProperty
元数据属性设置为 trueMetadata properties set to true AffectsMeasure

适用于