Skip to content

Instantly share code, notes, and snippets.

@scriptnull
Created June 13, 2014 14:27
Show Gist options
  • Save scriptnull/035e02fcaba7eba0bbf3 to your computer and use it in GitHub Desktop.
Save scriptnull/035e02fcaba7eba0bbf3 to your computer and use it in GitHub Desktop.
Layout, XAML , Grid , Stack Panel
<Page
x:Class="App4.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:App4"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<Grid x:Name="layoutGrid" Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<!--Design the Layout of the Grid first-->
<Grid.RowDefinitions>
<RowDefinition Height="140" />
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="2*" />
<ColumnDefinition Width="3*" />
</Grid.ColumnDefinitions>
<!--Elements of the grid
Use Attatched property to define the position of child element to the parent element
-->
<TextBlock Text="Hello World" Grid.Row="1" Grid.Column="1" FontSize="20" HorizontalAlignment="Right" Margin="0,20,70,0" />
<Grid Grid.Row="2" Grid.Column="1" >
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<TextBlock Text="Name" Grid.Column="0" />
<TextBox Grid.Column="1" />
<TextBlock Text="Address" Grid.Row="1" Grid.Column="0" />
<TextBox Grid.Column="1" Grid.Row="1" />
</Grid>
<StackPanel Grid.Row="2" Grid.Column="2" Orientation="Horizontal" VerticalAlignment="Top" >
<Button Content="Button 1" />
<Button Content="Button 1" />
<Button Content="Button 1" />
</StackPanel>
</Grid>
</Page
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment