A StackPanel is one of the more common containers for objects. Unlike in Windows Forms, you can’t directly (programmatically) add controls to a page or a window; you need a layout mechanism like a Stack Panel. (That stinks vaguely of Java Swing GUI development, which requires a layout component for objects.)
StackPanel control has two layouts: horizontal and vertical. Horizontal stacks items horizontally (like books on a shelf); vertical stacks items vertically, like a stack of dishes.
To add an object to a StackPanel (let’s call it
_controls), you would simply write:
Similarly, if you want to find a control, you iterate through the collection of
Children (which is a collection of