Mega Code Archive

 
Categories / Silverlight / Containers
 

Positioning UI Elements with a 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 x:Name="LayoutRoot" Background="White" Orientation="Horizontal">     <Rectangle Height="100" Fill="#FF000080" Stroke="#FF000000" Margin="4"                    MinWidth="100"/>     <Rectangle Height="100" Fill="#FFFFFF00" Stroke="#FF000000"                   Margin="0,0,4,0" MinWidth="100"/>     <Rectangle Height="100" Fill="#FF008000" Stroke="#FF000000" Margin="4,4"                   MinWidth="100"/>     <Rectangle Height="100" Fill="#FF00FFFF" Stroke="#FF000000" Margin="4,0"                   MinWidth="100"/>   </StackPanel> </UserControl>