Este artículo se tradujo automáticamente. Para ver el artículo en inglés, active la casilla Inglés. Además, puede mostrar el texto en inglés en una ventana emergente si mueve el puntero del mouse sobre el texto.
Traducción
Inglés

Método UIElement.Arrange (Rect)

 

Publicado: noviembre de 2016

Coloca los elementos secundarios y determina un tamaño para un UIElement. Los elementos primarios llaman a este método desde su implementación de ArrangeCore (o un equivalente de nivel de marco WPF) para formar una actualización de diseño recursiva. Este método constituye el segundo paso de una actualización de diseño.

Espacio de nombres:   System.Windows
Ensamblado:  PresentationCore (en PresentationCore.dll)

public void Arrange(
	Rect finalRect
)

Parámetros

finalRect
Type: System.Windows.Rect

Tamaño final que el elemento primario calcula para el elemento secundario, y que se proporciona como una instancia Rect.

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_noteNota

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
Disponible desde 3.0
Silverlight
Disponible desde 2.0
Windows Phone Silverlight
Disponible desde 7.0
Volver al principio
Mostrar: