Arrange UI Elements in a Horizontal or Vertical Stack : StackPanel « Windows Presentation Foundation « VB.Net






Arrange UI Elements in a Horizontal or Vertical Stack

Arrange UI Elements in a Horizontal or Vertical Stack
      

<Window x:Class="WpfApplication1.Window1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="WPF" Height="240" Width="250">
    <StackPanel Width="200">
        <StackPanel Height="50" Margin ="5" Orientation="Horizontal">
            <Button Content="Button _1" Margin="2" />
            <Button Content="Button _2" Margin="2" VerticalAlignment="Top"/>
            <Button Content="Button _3" Margin="2" VerticalAlignment="Center"/>
            <Button Content="Button _4" Margin="2" VerticalAlignment="Bottom"/>
            <Button Content="Button _5" Margin="2" />
        </StackPanel>
        <Separator />
        <StackPanel Margin="5" Orientation="Vertical">
            <Button Content="Button _A" Margin="2" />
            <Button Content="Button _B" HorizontalAlignment="Left" Margin="2" />
            <Button Content="Button _C" HorizontalAlignment="Center" Margin="2" />
            <Button Content="Button _D" HorizontalAlignment="Right" Margin="2" />
            <Button Content="Button _E" Margin="2" />
        </StackPanel>
    </StackPanel>
</Window>

   
    
    
    
    
    
  








Related examples in the same category

1.StackPanel with Button, Ellipse and ListBoxStackPanel with Button, Ellipse and ListBox
2.Set DataContext for StackPanelSet DataContext for StackPanel
3.StackPanel with Image BackGroundStackPanel with Image BackGround
4.Vertical StackPanelVertical StackPanel
5.Horizontal StackPanelHorizontal StackPanel
6.Put buttons to StackPanelPut buttons to StackPanel
7.Focus scope for StackPanelFocus scope for StackPanel
8.Add Button and TextBox to StackPanelAdd Button and TextBox to StackPanel
9.Align left along StackPanelAlign left along StackPanel
10.StackPanel with MinHeight, MinWidth, VerticalAlignment, HorizontalAlignmentStackPanel with MinHeight, MinWidth, VerticalAlignment, HorizontalAlignment
11.StackPanel with Label and TextBoxStackPanel with Label and TextBox
12.StackPanel search layoutStackPanel search layout
13.Using StackPanel to group elements for absolute positioningUsing StackPanel to group elements for absolute positioning
14.Search for an element by using Panel.FindName()Search for an element by using Panel.FindName()
15.Change StackPanel OrientationChange StackPanel Orientation
16.Use the methods that are defined by the IScrollInfo interface to scroll the child content of a StackPanel.Use the methods that are defined by the IScrollInfo interface to scroll the child content of a StackPanel.
17.Use StackPanel to arrange child objects in a single line that you can align horizontally or vertically.Use StackPanel to arrange child objects in a single line that you can align horizontally or vertically.