UIElement.OnChildDesiredSizeChanged(UIElement) UIElement.OnChildDesiredSizeChanged(UIElement) UIElement.OnChildDesiredSizeChanged(UIElement) UIElement.OnChildDesiredSizeChanged(UIElement) Method

定義

會在調整子項目的大小時支援配置行為。Supports layout behavior when a child element is resized.

protected:
 virtual void OnChildDesiredSizeChanged(System::Windows::UIElement ^ child);
protected virtual void OnChildDesiredSizeChanged (System.Windows.UIElement child);
abstract member OnChildDesiredSizeChanged : System.Windows.UIElement -> unit
override this.OnChildDesiredSizeChanged : System.Windows.UIElement -> unit
Protected Overridable Sub OnChildDesiredSizeChanged (child As UIElement)

參數

child
UIElement UIElement UIElement UIElement

正在調整大小的子項目。The child element that is being resized.

備註

您的應用程式程式碼通常不呼叫這個方法。This method is typically not called by your application code. 它會公開讓衍生的類別可以進行進一步的項目檢查其本身可能是無效的配置狀態。It is exposed so that derived element classes can make further checks on their own possibly invalid layout state. 類別可能也會嘗試最佳化,以根據子項目大小變更版面配置階段的處理時間降至最低。Classes could also attempt optimizations to minimize the processing time for a layout pass based on size changes to child elements. 範例衍生項目類別可實作OnChildDesiredSizeChangedGrid控制項。An example derived element class that implements OnChildDesiredSizeChanged is the Grid control.

給繼承者的注意事項

OnChildDesiredSizeChanged(UIElement)方法具有呼叫的預設實作InvalidateMeasure()本身。The OnChildDesiredSizeChanged(UIElement) method has the default implementation of calling InvalidateMeasure() on itself. 一般實作會是: 執行任何最佳化您自己的項目支援,並接著通常呼叫基底OnChildDesiredSizeChanged(UIElement)至少其中一個程式碼分支 (表示 「 中途 」 的狀態,每個快取邏輯自己的量值的一個)。A typical implementation would be: do whatever optimization your own element supports, and then typically call base OnChildDesiredSizeChanged(UIElement) from at least one of the code branches (the one that indicated "dirty" state per your own measure caching logic).

這個方法只會呼叫在版面配置,處理時的子系本身發出大小變更。This method is only called in the layout processing if it was the child itself that originated the size changes. 否則,如果父項目會起始Measure(Size)傳遞,版面配置系統規則,根據父代會重新計算版面配置已。Otherwise, if the parent element initiates the Measure(Size) pass, according to the layout system rules, the parent is recalculating layout already. 版面配置系統會處理子系的父系,順序的版面配置,因此是必要的子元素的版面配置呼叫沒有傳回父項目調整大小。The layout system processes layout in the order of child-to-parent, so no return to parent element sizing from the child element layout calls is necessary.

適用於