Class StackPanel
- Namespace
- Myra.Graphics2D.UI
- Assembly
- Myra.dll
Base class for containers that arrange children in a stack (either horizontally or vertically).
public abstract class StackPanel : Container, IItemWithId, INotifyAttachedPropertyChanged, IContainer
- Inheritance
-
StackPanel
- Implements
- Derived
- Inherited Members
Constructors
StackPanel()
Initializes a new instance of the StackPanel class.
protected StackPanel()
Fields
ProportionTypeProperty
Attached property that specifies the proportion type for a child element in a stack panel.
public static readonly AttachedPropertyInfo<ProportionType> ProportionTypeProperty
Field Value
ProportionValueProperty
Attached property that specifies the proportion value for a child element in a stack panel.
public static readonly AttachedPropertyInfo<float> ProportionValueProperty
Field Value
Properties
DefaultProportion
Gets or sets the default proportion for child elements.
[Browsable(false)]
public Proportion DefaultProportion { get; set; }
Property Value
GridLinesColor
Gets or sets the color of the grid lines shown for debugging.
public Color GridLinesColor { get; set; }
Property Value
- Color
Orientation
Gets the orientation of the stack panel (horizontal or vertical).
[Browsable(false)]
public abstract Orientation Orientation { get; }
Property Value
ShowGridLines
Gets or sets a value indicating whether grid lines should be shown for debugging.
public bool ShowGridLines { get; set; }
Property Value
Spacing
Gets or sets the spacing between child elements.
public int Spacing { get; set; }
Property Value
Methods
CopyFrom(Widget)
Copies properties from another stack panel to this one.
protected override void CopyFrom(Widget w)
Parameters
wWidgetThe source stack panel to copy from.
GetCellSize(int)
Gets the size of the cell at the specified index.
public int GetCellSize(int index)
Parameters
indexintThe zero-based index of the cell.
Returns
- int
The size of the cell.
GetProportionType(Widget)
Gets the proportion type for a widget in a stack panel.
public static ProportionType GetProportionType(Widget widget)
Parameters
widgetWidgetThe widget.
Returns
- ProportionType
The proportion type of the widget.
GetProportionValue(Widget)
Gets the proportion value for a widget in a stack panel.
public static float GetProportionValue(Widget widget)
Parameters
widgetWidgetThe widget.
Returns
- float
The proportion value of the widget.
InternalArrange()
Arranges child elements in the stack panel according to the stack orientation.
protected override void InternalArrange()
InternalMeasure(Point)
Measures the size required for all child elements in the stack panel.
protected override Point InternalMeasure(Point availableSize)
Parameters
availableSizePointThe available size for measurement.
Returns
- Point
The measured size of the stack panel.
InternalRender(RenderContext)
Renders the stack panel and optionally its grid lines for debugging.
public override void InternalRender(RenderContext context)
Parameters
contextRenderContextThe render context.
OnAttachedPropertyChanged(BaseAttachedPropertyInfo)
Handles changes to attached properties on the stack panel.
public override void OnAttachedPropertyChanged(BaseAttachedPropertyInfo propertyInfo)
Parameters
propertyInfoBaseAttachedPropertyInfoInformation about the changed property.
SetProportionType(Widget, ProportionType)
Sets the proportion type for a widget in a stack panel.
public static void SetProportionType(Widget widget, ProportionType value)
Parameters
widgetWidgetThe widget.
valueProportionTypeThe proportion type to set.
SetProportionValue(Widget, float)
Sets the proportion value for a widget in a stack panel.
public static void SetProportionValue(Widget widget, float value)
Parameters
UpdateChildren()
Updates the proportions of child elements in the stack panel.
protected void UpdateChildren()