Dieser Artikel wurde maschinell übersetzt. Wenn Sie die englische Version des Artikels anzeigen möchten, aktivieren Sie das Kontrollkästchen Englisch. Sie können den englischen Text auch in einem Popupfenster anzeigen, indem Sie den Mauszeiger über den Text bewegen.
Übersetzung
Englisch

UIElement.Arrange-Methode: (Rect)

 

Veröffentlicht: Oktober 2016

Positioniert untergeordnete Elemente und bestimmt die Größe für ein UIElement. Übergeordnete Elemente rufen diese Methode aus ihrer ArrangeCore-Implementierung (oder einer Entsprechung auf WPF-Frameworkebene) auf, um eine rekursive Layoutaktualisierung auszuführen. Diese Methode stellt die zweite Übergabe einer Layoutaktualisierung dar.

Namespace:   System.Windows
Assembly:  PresentationCore (in PresentationCore.dll)

public void Arrange(
	Rect finalRect
)

Parameter

finalRect
Type: System.Windows.Rect

Die endgültige Größe, die das übergeordnete Element für das untergeordnete Element berechnet, als eine Rect-Instanz.

For WPF framework-level element deriving scenarios, behavior for M:System.Windows.UIElement.Arrange(System.Windows.Rect) should not (and cannot, unless you shadow) be changed. Instead, you should override the M:System.Windows.FrameworkElement.ArrangeOverride(System.Windows.Size) implementation in your class. Your M:System.Windows.FrameworkElement.ArrangeOverride(System.Windows.Size) implementation is called internally by M:System.Windows.UIElement.Arrange(System.Windows.Rect) as part of default WPF framework-level layout operations. Your M:System.Windows.UIElement.ArrangeCore(System.Windows.Rect) implementation should also call M:System.Windows.FrameworkElement.ArrangeOverride(System.Windows.Size) on each child element, if it has child elements.

For WPF core-level element deriving scenarios, the behavior for M:System.Windows.UIElement.Arrange(System.Windows.Rect) should not (and cannot, unless you shadow) be changed. Instead, you should override M:System.Windows.UIElement.ArrangeCore(System.Windows.Rect) in your class. Your M:System.Windows.UIElement.ArrangeCore(System.Windows.Rect) implementation is called internally by M:System.Windows.UIElement.Arrange(System.Windows.Rect) as part of default WPF framework-level layout operations. However, this assumes you are using WPF framework-level layout and its layout system, which is often not the case if you are specifically deriving elements at the WPF core-level from the T:System.Windows.UIElement base element class. Your M:System.Windows.UIElement.ArrangeCore(System.Windows.Rect) implementation should also call M:System.Windows.UIElement.Arrange(System.Windows.Rect) on each child element, if it has child elements. Note that the WPF core-level scenario implies that you are not using a T:System.Windows.FrameworkElement derived class, because T:System.Windows.FrameworkElement seals M:System.Windows.FrameworkElement.ArrangeCore(System.Windows.Rect).

Computation of WPF framework-level layout positioning in TLA#tla_winclient consists of a M:System.Windows.UIElement.Measure(System.Windows.Size) call and an M:System.Windows.UIElement.Arrange(System.Windows.Rect) call. During the M:System.Windows.UIElement.Measure(System.Windows.Size) call, the layout system determines an element's size requirements using a provided T:System.Windows.Size (availableSize) argument. During the M:System.Windows.UIElement.Arrange(System.Windows.Rect) call, the layout system finalizes the size and position of an element's bounding box. For more information, see Layout.

availableSize can be any number from zero to infinity. Elements to be laid out return the minimum Size they require through the availableSize parameter.

When a layout is first instantiated, it always receives a M:System.Windows.UIElement.Measure(System.Windows.Size) call before M:System.Windows.UIElement.Arrange(System.Windows.Rect). However, after the first layout pass, it may receive an M:System.Windows.UIElement.Arrange(System.Windows.Rect) call without a M:System.Windows.UIElement.Measure(System.Windows.Size); this can happen when a property that affects only M:System.Windows.UIElement.Arrange(System.Windows.Rect) is changed (such as alignment), or when the parent receives an M:System.Windows.UIElement.Arrange(System.Windows.Rect) without a M:System.Windows.UIElement.Measure(System.Windows.Size). A M:System.Windows.UIElement.Measure(System.Windows.Size) call will automatically invalidate an M:System.Windows.UIElement.Arrange(System.Windows.Rect) call.

Layout updates generally occur asynchronously (at a time determined by the layout system). An element might not immediately reflect changes to properties that affect element sizing (such as P:System.Windows.FrameworkElement.Width).

System_CAPS_noteHinweis

Layout updates can be forced by using the M:System.Windows.UIElement.UpdateLayout method; however, calling this function is not recommended, as it is usually unnecessary and can cause poor performance. In many situations where calling M:System.Windows.UIElement.UpdateLayout might be appropriate, the layout system will probably already be processing updates. The layout system can process layout changes in a manner that can optimize all necessary updates as part of a package.

The layout system keeps two separate queues of invalid layouts, one for M:System.Windows.UIElement.Measure(System.Windows.Size) and one for M:System.Windows.UIElement.Arrange(System.Windows.Rect). The layout queue is sorted based upon the order of elements in the visual tree. Elements higher in the tree are at the top of the queue, in order to avoid redundant layouts caused by repeated changes in parents. Duplicate entries are automatically removed from the queue, and elements are automatically removed from the queue if they are already valid.

When updating layout, the M:System.Windows.UIElement.Measure(System.Windows.Size) queue is emptied first, followed by the M:System.Windows.UIElement.Arrange(System.Windows.Rect) queue. An element in the M:System.Windows.UIElement.Arrange(System.Windows.Rect) queue will never be arranged if there is an element in the M:System.Windows.UIElement.Measure(System.Windows.Size) queue.

.NET Framework
Verfügbar seit 3.0
Silverlight
Verfügbar seit 2.0
Windows Phone Silverlight
Verfügbar seit 7.0
Zurück zum Anfang
Anzeigen: