Mega Code Archive

 
Categories / Silverlight / Containers
 

Implementing a Grid to Set the Layout of Silverlight Controls

<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 x:Name="LayoutRoot"        Background="White"        ShowGridLines="True">     <Grid.RowDefinitions>          <RowDefinition Height="50"/>          <RowDefinition/>          <RowDefinition/>     </Grid.RowDefinitions>      <Grid.ColumnDefinitions>          <ColumnDefinition Width="150"/>          <ColumnDefinition Width="10"/>          <ColumnDefinition/>      </Grid.ColumnDefinitions>     <Canvas Background="Black"              Grid.Column="0"              Grid.ColumnSpan="3">         <TextBlock Text="this is a test" FontSize="30" Margin="50,5,0,0"                     Foreground="White"/>     </Canvas>      <Image Source="image.jpg"             Grid.Row="1" Grid.Column="0"             Height="100" Width="150" />     <Image Source="image2.jpg"             Grid.Row="2" Grid.Column="0"             Height="100" Width="150" />      <TextBox BorderThickness="2"               Grid.Row="1" Grid.Column="2"               Height="100" Width="200" />      <TextBox BorderThickness="2"               Grid.Row="2" Grid.Column="2"               Height="100" Width="200" /> </Grid> </UserControl>