StackPanel
The StackPanel container control will position each of its child controls in a line, vertically (default) or horizontally, and displays a scrollbar when there is no more room horizontally or vertically.
Use the StackPanel when you want a variable set of controls.
Properties
The key properties of a StackPanel include:
- The Orientation of the child controls added to the StackPanel can be Vertical or Horizontal.
- The default value for both the HorizontalAlignment and the VerticalAlignment of the content contained in a StackPanel is Stretch.
Scripting Syntax
The properties of a control include events. Scripts can be used to set the properties of a control or be used to trigger an action associated with an event. For a StackPanel:
- The contents of a StackPanel are its child controls or Children. To add a control to the StackPanel use the following syntax:
def AddBtnButton_Click(sender, e): control= Button() control.Width = 80 control.Height = 20 control.Content = 'Add Ellipse' control.Click += AddEllipseDynamic StackPanel1.Children.Add(control)