RelativeSource.ShouldSerializeAncestorType 方法

定義

指示是否應該保存 AncestorType 屬性。

public:
 bool ShouldSerializeAncestorType();
public bool ShouldSerializeAncestorType ();
member this.ShouldSerializeAncestorType : unit -> bool
Public Function ShouldSerializeAncestorType () As Boolean

傳回

Boolean

如果屬性值已經從其預設值變更,則為 true,否則為 false

備註

因為 屬性沒有簡單的預設值, AncestorType 所以會提供這個 ShouldSerialize 方法。 這個方法會指出屬性是否已從其預設值變更。 如果您要開發 的設計 RelativeSource 工具,或開發自己的控制項併入 RelativeSource ,您通常會叫用這個方法。

如需詳細資訊,請參閱 使用 ShouldSerialize 和 Reset 方法定義預設值

適用於