Partilhar via


GreedyWrapPanel Class

Definition

This panel is very similar to a WrapPanel, but instead of wrapping when a boundry is reached, it wraps once it has enough space. For Orientation=Vertical, this means that it will use as many columns as it can, given enough children and width. For Orientation=Horizontal, it will use as many rows as it can, given enought children and height. You can also specify a maximum number of wrapping levels (columns for Vertical, rows for Horizontal) with MaxWrappingLevels.

public ref class GreedyWrapPanel : System::Windows::Controls::Panel
public class GreedyWrapPanel : System.Windows.Controls.Panel
type GreedyWrapPanel = class
    inherit Panel
Public Class GreedyWrapPanel
Inherits Panel
Inheritance
GreedyWrapPanel

Constructors

GreedyWrapPanel()

Initializes a new instance of GreedyWrapPanel.

Fields

ActualWrappingLevelsProperty

A read-only property that is the actual number of levels we are using, regardless of what MaxLevels is set to. For Orientation=Vertical, this corresponds to Columns, while for Orientation=Horizontal, this corresponds to Rows.

MaxWrappingLevelsProperty

Gets or sets the maximum wrapping levels.

OrientationProperty

The orientation property.

Properties

ActualWrappingLevels

Readonly property that is the actual number of levels we are using, regardless of what MaxLevels is set to. For Orientation=Vertical, this corresponds to Columns, while for Orientation=Horizontal, this corresponds to Rows. If 1, this acts like a normal StackPanel. Value must be set to a value greater than zero.

MaxWrappingLevels

For Orientation=Horizontal, it is the maximum number of rows. For Orientation=Vertical, it is the maximum number of columns. If 1, this acts like a normal StackPanel. Value must be set to a value greater than zero.

Orientation

This property controls the direction that elements flow. If Vertical, elements flow from top to bottom. If Horizontal, elements flow from left to right.

Methods

ArrangeOverride(Size)

This method arranges the children. For Orientation=Vertical, it uses as many columns as it can, until it reaches MaxWrappingLevels. For Orientation=Horizontal, it uses the maximum number of rows possible. However, for both, their columns or rows respectively will never be more than MaxWrappingLevels.

MeasureOverride(Size)

This method calculates the amount of space this panel will request. For Orientation=Vertical, it will use as many columns as it has space and children for. For Orientation=Horizontal, it will use as many rows as it has space and children for.

Applies to