FrameworkElement.OverridesDefaultStyle FrameworkElement.OverridesDefaultStyle FrameworkElement.OverridesDefaultStyle FrameworkElement.OverridesDefaultStyle Property

定義

取得或設定此元素的樣式屬性是否來自佈景主題樣式的值。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

屬性值

如果這個項目不會使用佈景主題樣式,所有從樣式產生的屬性都來自本機應用程式樣式,且佈景主題樣式屬性不會套用,則為 truetrue 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.

備註

這個屬性的最常見用法是在提供主題樣式的樣式 setter 內的間接使用方式。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

適用於