<Page
    x:Class="DataBinding.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:DataBinding"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d">

    <Page.Resources>
        <!-- Listing 19-35 -->
        <DataTemplate x:Key="personTemplate">
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition />
                    <RowDefinition />
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition />
                </Grid.ColumnDefinitions>

                <TextBlock Text="Imię:" VerticalAlignment="Center"/>
                <TextBox Grid.Column="1" Margin="3"
                    Text="{Binding Path=Name, Mode=TwoWay}" />

                <TextBlock Grid.Row="1" Text="Wiek:" VerticalAlignment="Center"/>
                <TextBox Grid.Row="1" Grid.Column="1" Margin="3"
                    Text="{Binding Path=Age}" />
            </Grid>
        </DataTemplate>
        
        <!-- Listing 19-38
             Ten kod działa tylko w aplikacjach WPF oraz Silverlight więc został umieszczony w komentarzu
             <DataTemplate DataType="{x:Type local:Person}">
        -->
    </Page.Resources>
    <Grid Background="{StaticResource ApplicationPageBackgroundThemeBrush}">

        <Grid HorizontalAlignment="Left" VerticalAlignment="Top" Width="364" Height="304" Margin="130,87,0,0">
            <!-- Listing 19-37 -->
            <ListBox ItemsSource="{Binding}"
                 ItemTemplate="{StaticResource personTemplate}" />
        </Grid>
    </Grid>
</Page>
