FrameworkPropertyMetadata.AffectsArrange FrameworkPropertyMetadata.AffectsArrange FrameworkPropertyMetadata.AffectsArrange FrameworkPropertyMetadata.AffectsArrange Property

定義

取得或設定值,指出相依性屬性在配置引擎作業期間,是否可能會影響排列傳遞。Gets or sets a value that indicates whether a dependency property potentially affects the arrange pass during layout engine operations.

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

屬性值

如果這個中繼資料所在的相依性屬性可能會影響排列傳遞,則為 true;否則為 falsetrue if the dependency property on which this metadata exists potentially affects the arrange pass; otherwise, false. 預設為 falseThe default is false.

例外狀況

中繼資料已套用至相依性屬性作業,因此中繼資料已密封,而且無法設定中繼資料的屬性。The metadata has already been applied to a dependency property operation, so that metadata is sealed and properties of the metadata cannot be set.

範例

下列範例會從各種不同的相依性屬性欄位取得的預設中繼資料、 查詢的各種值FrameworkPropertyMetadata屬性,並填入資料表,以實作 「 中繼資料瀏覽器 」 中使用的資訊。The following example obtains the default metadata from various dependency property fields, queries the value of various FrameworkPropertyMetadata properties on it, and uses the information to populate a table to implement a "metadata browser".

pm = dp.GetMetadata(dp.OwnerType);
pm = dp.GetMetadata(dp.OwnerType)
FrameworkPropertyMetadata fpm = pm as FrameworkPropertyMetadata;
if (fpm!=null) {
    AffectsArrange.Text = (fpm.AffectsArrange) ? "Yes" : "No";
    AffectsMeasure.Text = (fpm.AffectsMeasure) ? "Yes" : "No";
    AffectsRender.Text = (fpm.AffectsRender) ? "Yes" : "No";
    Inherits.Text = (fpm.Inherits) ? "Yes" : "No";
    IsDataBindingAllowed.Text = (fpm.IsDataBindingAllowed) ? "Yes" : "No";
    BindsTwoWayByDefault.Text = (fpm.BindsTwoWayByDefault) ? "Yes" : "No";
}         
Dim fpm As FrameworkPropertyMetadata = TryCast(pm, FrameworkPropertyMetadata)
If fpm IsNot Nothing Then
	AffectsArrange.Text = If((fpm.AffectsArrange), "Yes", "No")
	AffectsMeasure.Text = If((fpm.AffectsMeasure), "Yes", "No")
	AffectsRender.Text = If((fpm.AffectsRender), "Yes", "No")
              [Inherits].Text = If((fpm.Inherits), "Yes", "No")
	IsDataBindingAllowed.Text = If((fpm.IsDataBindingAllowed), "Yes", "No")
	BindsTwoWayByDefault.Text = If((fpm.BindsTwoWayByDefault), "Yes", "No")

備註

FrameworkElementFrameworkContentElement包含實作OnPropertyChanged,以監視所有存在的項目的相依性屬性的有效值變更。FrameworkElement and FrameworkContentElement include an implementation of OnPropertyChanged that monitors effective value changes to all dependency properties that exist on an element. 這個邏輯的一部分,變更生效的相依性屬性值,並已使用的中繼資料AffectsArrange設定為true將會起始要使其失效的視覺效果,該元素的延後的要求 (呼叫InvalidateArrange)。As part of that logic, dependency properties that change effective value and have metadata with AffectsArrange set to true will initiate a deferred request to invalidate the visuals for that element (a call to InvalidateArrange). 由於此 WPF 架構層級實作已在進行中,您通常不需要相依性屬性,以尋找AffectsArrange除非本質上被取代或修改的 WPF 架構層級的版面配置行為。Because this WPF framework-level implementation is already in place, you typically do not need to look for dependency properties with AffectsArrange unless you are substantially replacing or modifying the WPF framework-level layout behavior.

自訂OnPropertyChanged實作可能會選擇將類似的行為,相依性屬性變更的地方AffectsArrangetrueCustom OnPropertyChanged implementations might choose to have similar behavior for dependency property changes where AffectsArrange is true.

在衍生類別的屬性PropertyMetadata通常定義為讀寫的物件模型中。Properties on derived classes of PropertyMetadata are typically defined in the object model as read-write. 這是讓它們可以調整執行個體初始化後。This is so they can be adjusted after initialization of the instance. 不過,中繼資料使用一部分的呼叫之後RegisterAddOwner,或OverrideMetadata屬性系統會將密封該中繼資料執行個體,傳遞的中繼資料特性的屬性現在會被視為不變。However, after the metadata is consumed as part of a call to Register, AddOwner, or OverrideMetadata, the property system will seal that metadata instance and properties that convey the specifics of the metadata are now considered immutable. 嘗試設定此屬性之後IsSealedtrue此中繼資料執行個體將會引發例外狀況。Attempting to set this property after IsSealed is true on this metadata instance will raise an exception.

XAML 文字使用方式XAML Text Usage

這個類別的成員不常使用在XAMLXAMLMembers of this class are either not typically used in XAMLXAML.

適用於

另請參閱