<UserControl x:Class="MvvmLightDemo.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    Width="Auto" Height="Auto" 
    DataContext="{Binding Source={StaticResource Locator}, Path=Main}"
    mc:Ignorable="d" 
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    d:DesignHeight="394" d:DesignWidth="767" 
    xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk">

    <UserControl.Resources>
        <ResourceDictionary>            
            <DataTemplate x:Key="customerListBoxItemsTemplate">
                <Grid>
                    <TextBlock Text="{Binding CompanyName}"
                    TextTrimming="WordEllipsis" />
                </Grid>
            </DataTemplate>
        </ResourceDictionary>
    </UserControl.Resources>
    
    <Grid x:Name="LayoutRoot" Background="White" >
        <Grid.RowDefinitions>
            <RowDefinition Height="50*" />
            <RowDefinition Height="304*" />
            <RowDefinition Height="40*" />
        </Grid.RowDefinitions>
        <TextBlock Name="textBlock1" Text="Mvvm Light Demo" Grid.ColumnSpan="2" FontSize="40" TextAlignment="Center" />
        <TextBlock Grid.Row="2" Name="textBlock2" Text="{Binding Path=Message}" Margin="8,0,0,0" />
        <Grid Grid.Row="1">
        	<Grid.ColumnDefinitions>
        		<ColumnDefinition Width="172"/>
        		<ColumnDefinition/>
        	</Grid.ColumnDefinitions>
        	<ListBox x:Name="listBox1" 
                     ItemsSource="{Binding Customers}" 
                     SelectedItem="{Binding Path=CurrentCustomer, Mode=TwoWay}"
                     ItemTemplate="{StaticResource customerListBoxItemsTemplate}"
                     Margin="0,0,2,0"  />
        	<Grid x:Name="grid1" 
        		DataContext="{Binding CurrentCustomer}"
                  Margin="10,0,0,0" Grid.Column="1">
        		<Grid.ColumnDefinitions>        		
        			<ColumnDefinition Width="75*" />
        			<ColumnDefinition Width="510*" />
        		</Grid.ColumnDefinitions>
        		<Grid.RowDefinitions>
        			<RowDefinition Height="Auto"  />
        			<RowDefinition Height="Auto"  />
        			<RowDefinition Height="Auto"  />
                    <RowDefinition Height="Auto"  />
        		</Grid.RowDefinitions>
        		<TextBox Grid.ColumnSpan="2" Text="{Binding CompanyName, Mode=TwoWay}" FontSize="32" TextWrapping="Wrap" />
        		<TextBlock Grid.Row="1" TextWrapping="Wrap" Text="Id" VerticalAlignment="Center" HorizontalAlignment="Left" FontSize="16" Margin="0,8" />
        		<TextBlock Grid.Row="2" TextWrapping="Wrap" Text="Country" VerticalAlignment="Center" HorizontalAlignment="Left" FontSize="16" Margin="0,8" />
        		<TextBox Grid.Column="1" Grid.Row="1" TextWrapping="NoWrap" VerticalAlignment="Center" IsReadOnly="True" Width="265" HorizontalAlignment="Left" Text="{Binding Path=CustomerID, Mode=TwoWay}" />
        		<TextBox Grid.Column="1" HorizontalAlignment="Left" Grid.Row="2" TextWrapping="Wrap" Text="{Binding Country, Mode=TwoWay}" Width="188" VerticalAlignment="Center" Margin="0" />
                <TextBlock Grid.Row="3" TextWrapping="Wrap" Text="Orders" VerticalAlignment="Center" HorizontalAlignment="Left" FontSize="16" Margin="0,8" />
                <sdk:DataGrid AutoGenerateColumns="true" Grid.Column="1" Grid.Row="3" HorizontalAlignment="Left" Margin="0,8" VerticalAlignment="Center" Height="100" Width="500" ItemsSource="{Binding Orders}"/>
            </Grid>
        	<sdk:GridSplitter HorizontalAlignment="Left"  Width="10" Grid.Column="1" />
        </Grid>
    </Grid>
</UserControl>
