UIElement.ArrangeCore(Rect) UIElement.ArrangeCore(Rect) UIElement.ArrangeCore(Rect) UIElement.ArrangeCore(Rect) Method

定義

定義 WPF 核心層級排列版面配置定義的範本。Defines the template for WPF core-level arrange layout definition.

protected:
 virtual void ArrangeCore(System::Windows::Rect finalRect);
protected virtual void ArrangeCore (System.Windows.Rect finalRect);
abstract member ArrangeCore : System.Windows.Rect -> unit
override this.ArrangeCore : System.Windows.Rect -> unit
Protected Overridable Sub ArrangeCore (finalRect As Rect)

參數

finalRect
Rect Rect Rect Rect

父系內該項目應該用來排列本身和其子項目的最終區域。The final area within the parent that element should use to arrange itself and its child elements.

範例

ArrangeCore 實作應該呼叫基底實作傳回的大小,然後呼叫Arrange每個可見子項目的的方法,並調解這些所傳回的大小Arrange呼叫基底實作的大小。ArrangeCore implementations should call the base implementation to return a size, then call the Arrange method of each visible child element, and reconcile the sizes returned by these Arrange calls with the size of the base implementation. 對帳層面的邏輯ArrangeCore實作可能會有所不同,視您的項目配置特性而定。The logic for the reconciliation aspect of a ArrangeCore implementation might vary, depending on the layout characteristics of your element. 在下列的範例範本中,VisualChildren是假設性的屬性,您的項目可能會定義為了列舉其內容;UIElement未定義內容的集合在這個層級中,WPF 架構層級架構會延後內容的行為,例如特定的控制項或控制項基底類別的衍生項目。In the following example template, VisualChildren is a hypothetical property that your element might define to help enumerate its content; UIElement does not define content collections at this level, the WPF framework-level architecture defers content behavior to derived elements such as specific controls or control base classes.

protected override void ArrangeCore(Rect finalRect)
{
     //Call base, it will set offset and RenderBounds to the finalRect:
     base.ArrangeCore(finalRect);
     foreach (UIElement child in VisualChildren)
     {
         child.Arrange(new Rect(childX, childY, childWidth, childHeight));
     }
 }
Protected Overrides Sub ArrangeCore(ByVal finalRect As Rect)
	 'Call base, it will set offset and RenderBounds to the finalRect:
	 MyBase.ArrangeCore(finalRect)
	 For Each child As UIElement In VisualChildren
		 child.Arrange(New Rect(childX, childY, childWidth, childHeight))
	 Next child
End Sub

備註

注意

覆寫此方法時,才適用如果您所衍生的 WPF 核心層級,而且您不想要使用 WPF 架構層級配置系統並FrameworkElement衍生類別,因為FrameworkElement標誌ArrangeCoreOverriding this method is only appropriate if you are deriving at the WPF core-level, and you are not using the WPF framework-level layout system and FrameworkElement derived class, because FrameworkElement seals ArrangeCore. 如果您使用的 WPF 架構層級配置系統,適當的方法,來覆寫特定類別的配置排列行為是ArrangeOverrideIf you are using the WPF framework-level layout system, the appropriate method to override for class-specific layout arrange behavior is ArrangeOverride.

給繼承者的注意事項

如果您正在開發的 WPF 核心層級的項目,您應該覆寫此方法,讓您的 WPF 核心層級項目唯一排列版面配置行為,或進行適當的版面配置決策的相關元素的子項目。If you are developing elements at the WPF core level,you should override this method to give your WPF core-level element a unique arrange layout behavior, or to make proper layout decisions about the child elements of your elements. 覆寫可能會需要這些子項目不是從已定義的模式可辨識這類ItemCollectionAn override might be necessary if those child elements are not recognizable from a defined pattern such as an ItemCollection.

父項目必須呼叫類別的特定Arrange(Rect)上每個子項目,否則這些子項目不會轉譯。A parent element must call the class-specific Arrange(Rect) on each child element, otherwise those child elements are not rendered.

適用於