<UserControl x:Class="TutorialsSilverlight.MasterDetailBinding"
    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:DesignHeight="516" d:DesignWidth="918" xmlns:c1="http://schemas.componentone.com/winfx/2006/xaml" xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition/>
            <RowDefinition/>
        </Grid.RowDefinitions>
        
        <c1:C1DataSource Name="c1DataSource1" DomainContextTypeName="TutorialsSilverlight.Web.DomainService1">
            <c1:RiaViewSource QueryName="GetCategories" />
        </c1:C1DataSource>
        
        <!-- Master grid showing Categories. -->
        <c1:C1DataGrid AutoGenerateColumns="True" Margin="10" Name="dataGrid1" ItemsSource="{Binding [GetCategories], ElementName=c1DataSource1}" />
        <!-- Detail grid showing Products of the current Category. -->
        <c1:C1DataGrid AutoGenerateColumns="True" Margin="10" Grid.Row="1" Name="dataGrid2" ItemsSource="{Binding SelectedItem.Products, ElementName=dataGrid1}">
            <!-- This control handler converts navigation property columns, such as Category, to lookup columns. -->
            <c1:C1DataSource.ControlHandler>
                <c1:ControlHandler AutoLookup="True" DataSource="{Binding ElementName=c1DataSource1}"/>
            </c1:C1DataSource.ControlHandler>
        </c1:C1DataGrid>
    </Grid>
</UserControl>
