Class StackPanel
Arranges child controls into a single line that can be oriented horizontally or vertically.
[ControlCategory("Containers")]
public class StackPanel : Control, IBaseObject, IDisposableObject, IInputElement, ISupportInitialize, IFocusable, IWin32Window, ITextProperty, IComponent, IDisposable
- Inheritance
-
StackPanel
- Implements
- Derived
- Extension Methods
Examples
Here is how to declare a StackPanel in UIXML:
<StackPanel Name="stackPanel" Margin="16,16,16,254" Orientation="Vertical">
<Button Text="Add Item" Name="addItemButton" Margin="8"/>
<Button Text="Remove Item" Name="removeItemButton" Margin="8"/>
</StackPanel>
Also, a StackPanel can be created from code:
var StackPanel = new Alternet.UI.StackPanel { Orientation = StackPanelOrientation.Vertical, Padding = new Thickness(10) };
StackPanel.Children.Add(new Button() { Text = "Add Item", Margin = new Thickness(8, 8, 8, 8) });
StackPanel.Children.Add(new Button() { Text = "remove Item", Margin = new Thickness(8, 8, 8, 8) });
Remarks
A StackPanel contains a collection of Control objects, which are in the Children property.
The Orientation specifies the dimension by which child controls are stacked.
Examples of how a StackPanel can look on different platforms:
Set Orientation property to specify the dimension by which child controls are stacked.
Properties
- AllowStretch
Gets or sets whether last child control can be stretched if it's alignment property is set to Stretch.
- ControlKind
Returns control identifier.
- Orientation
Gets or sets a value that indicates the dimension by which child controls are stacked.
Methods
- OnOrientationChanged(EventArgs)
Called when the value of the Orientation property changes.
Events
- OrientationChanged
Occurs when the value of the Orientation property changes.