Layout with StackPanel : StackPanel « Containers « Silverlight






Layout with StackPanel

Layout with StackPanel
    

<UserControl x:Class='SilverlightApplication3.MainPage'
    xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation' 
    xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'
    xmlns:d='http://schemas.microsoft.com/expression/blend/2008' 
    xmlns:mc='http://schemas.openxmlformats.org/markup-compatibility/2006' 
    mc:Ignorable='d' 
    d:DesignWidth='640' 
    d:DesignHeight='480'>

  <StackPanel Margin="3" Background="White">
    <TextBlock Margin="3" HorizontalAlignment="Center" Text="A Button Stack"></TextBlock>
    <Button Margin="3" HorizontalAlignment="Left" Content="Button 1"></Button>
    <Button Margin="3" HorizontalAlignment="Right" Content="Button 2"></Button>
    <Button Margin="3" Content="Button 3"></Button>
    <Button Margin="3" Content="Button 4"></Button>
  </StackPanel>

</UserControl>

   
    
    
    
  








Related examples in the same category

1.Positioning UI Elements with a StackPanelPositioning UI Elements with a StackPanel
2.Using a StackPanel controlUsing a StackPanel control
3.StackPanel.Orientation=Vertical
4.Horizontal StackPanel exampleHorizontal StackPanel example
5.A basic StackPanel with three elementsA basic StackPanel with three elements
6.A basic StackPanel that uses a Horizontal OrientationA basic StackPanel that uses a Horizontal Orientation
7.A StackPanel with three VisibleUIElement itemsA StackPanel with three VisibleUIElement items
8.A StackPanel with a CollapsedUIElementA StackPanel with a CollapsedUIElement
9.Simple StackPanel
10.Set height, Background and Orientation for StackPanel
11.Change StackPanel Orientation
12.Use StackPanel to arrange child objects in a single line that you can align horizontally or vertically.
13.Put controls into StackPanelPut controls into StackPanel
14.Nested StackPanelsNested StackPanels