MultiColumnPanel Class
Provides an implementation of a Panel that can render child elements in multiple columns, collapsing columns down as available space decreases.
public class MultiColumnPanel : Panel
- Inheritance:
- object Visual UIElement FrameworkElement Panel object
Constructors
MultiColumnPanel()
Initializes an instance of the MultiColumnPanel
class.
public MultiColumnPanel()
Properties
CanRemoveEmptyColumns
Gets or sets whether columns without any items can be removed, with remaining columns filling in, thereby maximizing use of available width.
public bool CanRemoveEmptyColumns { get; set; }
Property Value
- bool:
true
if columns without any items can be removed; otherwise,false
. The default value isfalse
.
Remarks
When using multiple MultiColumnPanel instances in a stack where columns should always be aligned, leave this property its default of false
.
Alternatively when wanting to maximize use of available width, set this property to true
.
ColumnMargin
Gets or sets the margin width between columns.
public double ColumnMargin { get; set; }
Property Value
- double:
The margin width between columns. The default value is
50.0
.
ColumnMinWidth
Gets or sets the minimum column width needed for another column to be added.
public double ColumnMinWidth { get; set; }
Property Value
- double:
The minimum column width needed for another column to be added. The default value is
300.0
.
MaxColumnCount
Gets or sets the maximum column count.
public int MaxColumnCount { get; set; }
Property Value
- int:
The maximum column count. The default value is
2
.
Methods
ArrangeOverride(Size)
When overridden in a derived class, positions child elements and determines a size for a FrameworkElement derived class.
protected override Size ArrangeOverride(Size finalSize)
Parameter | Type | Description |
---|---|---|
finalSize | Size | The final area within the parent that this element should use to arrange itself and its children. |
Returns
- Size:
The actual size used.
MeasureOverride(Size)
Measures all children given an available size and returns the element's desired size based on the size of its children.
protected override Size MeasureOverride(Size availableSize)
Parameter | Type | Description |
---|---|---|
availableSize | Size | The size the element is suggested to fit inside. |
Returns
- Size:
The desired size of the element.
Fields
CanRemoveEmptyColumnsProperty
Identifies the CanRemoveEmptyColumns dependency property. This field is read-only.
public static readonly DependencyProperty CanRemoveEmptyColumnsProperty
ColumnMarginProperty
Identifies the ColumnMargin dependency property. This field is read-only.
public static readonly DependencyProperty ColumnMarginProperty
ColumnMinWidthProperty
Identifies the ColumnMinWidth dependency property. This field is read-only.
public static readonly DependencyProperty ColumnMinWidthProperty
MaxColumnCountProperty
Identifies the MaxColumnCount dependency property. This field is read-only.
public static readonly DependencyProperty MaxColumnCountProperty