<UserControl x:Class="TutorialsSilverlight.ServerSideFiltering"
    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="503" d:DesignWidth="874" xmlns:c1="http://schemas.componentone.com/winfx/2006/xaml" xmlns:riaControls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.DomainServices" xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="394*" />
            <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>
      
        <c1:C1DataSource Name="c1DataSource1" DomainContextTypeName="TutorialsSilverlight.Web.DomainService1" Grid.Column="1">
            <c1:RiaViewSource QueryName="GetCategories" />
            <c1:RiaViewSource QueryName="GetProducts">
                <!-- Filtering specified with FilterDescriptors is performed on the server. -->
                <c1:RiaViewSource.FilterDescriptors>
                    <!-- Products with CategoryID equal to FilterDescriptor.Value. -->
                    <riaControls:FilterDescriptor Operator="IsEqualTo" PropertyPath="CategoryID" />
                </c1:RiaViewSource.FilterDescriptors>
            </c1:RiaViewSource>
        </c1:C1DataSource>

        <!-- A combo box for choosing product categories. -->
        <StackPanel Orientation="Horizontal" Margin="2">
            <TextBlock Text="Category: " VerticalAlignment="Center"/>
            <ComboBox Name="comboBox1" HorizontalAlignment="Left" Width="186" ItemsSource="{Binding [GetCategories], ElementName=c1DataSource1}" DisplayMemberPath="CategoryName" />
        </StackPanel>
        <!-- A data grid showing products of the current category. -->
        <c1:C1DataGrid AutoGenerateColumns="True" Grid.Row="1" Name="dataGrid1" ItemsSource="{Binding [GetProducts], ElementName=c1DataSource1}" >
            <!-- This control handler converts navigation property columns, such as Category, to lookup columns. -->
            <c1:C1DataSource.ControlHandler>
                <c1:ControlHandler AutoLookup="True"/>
            </c1:C1DataSource.ControlHandler>
        </c1:C1DataGrid>
        <Button Grid.Row="2" Margin="4" Content="Save Changes" Height="23" HorizontalAlignment="Right" Name="button1" Width="102" />
    </Grid>
</UserControl>
