Mega Code Archive

 
Categories / Silverlight / Containers
 

Place and size rectangles and ellipses in Grid cells

<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'>   <Grid ShowGridLines="True">     <Grid.RowDefinitions>       <RowDefinition Height="Auto" />       <RowDefinition />       <RowDefinition />     </Grid.RowDefinitions>     <Grid.ColumnDefinitions>       <ColumnDefinition Width="Auto" />       <ColumnDefinition />       <ColumnDefinition />       <ColumnDefinition />     </Grid.ColumnDefinitions>     <TextBlock Grid.Column="0" Grid.Row="1" Text="Rectagle"       Margin="5" />     <TextBlock Grid.Column="0" Grid.Row="2" Text="Ellipse"       Margin="5" />     <TextBlock Grid.Column="1" Grid.Row="0" Text="Fill"       TextAlignment="Center" Margin="5" />     <TextBlock Grid.Column="2" Grid.Row="0" Text="Uniform"       TextAlignment="Center" Margin="5" />     <TextBlock Grid.Column="3" Grid.Row="0" Text="UniformToFill"       TextAlignment="Center" Margin="5" />     <Rectangle Grid.Column="1" Grid.Row="1" Fill="Red"       Stroke="Black" Stretch="Fill" Margin="5" />     <Rectangle Grid.Column="2" Grid.Row="1" Fill="LightGray"       Stroke="Black" Stretch="Uniform" Margin="5" />     <Rectangle Grid.Column="3" Grid.Row="1" Fill="LightGray"       Stroke="Black" Stretch="UniformToFill" Margin="5" />     <Ellipse Grid.Column="1" Grid.Row="2" Fill="LightGray"       Stroke="Black" Stretch="Fill" Margin="5" />     <Ellipse Grid.Column="2" Grid.Row="2" Fill="LightGray"       Stroke="Black" Stretch="Uniform" Margin="5" />     <Ellipse Grid.Column="3" Grid.Row="2" Fill="LightGray"       Stroke="Black" Stretch="UniformToFill" Margin="5" />   </Grid> </UserControl>