<Window x:Class="TutorialsWPF.ServerSideFiltering"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="ServerSideFiltering" Height="507" Width="945" xmlns:c1="http://schemas.componentone.com/winfx/2006/xaml" xmlns:my="clr-namespace:TutorialsWPF">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="394*" />
            <RowDefinition Height="42"/>
        </Grid.RowDefinitions>
        
        <c1:C1DataSource Name="c1DataSource1" ContextType="my:NORTHWNDEntities">
            <c1:EntityViewSource EntitySetName="Categories" />
            <c1:EntityViewSource EntitySetName="Products">
                <!-- Filtering specified with FilterDescriptors is performed on the server. -->
                <c1:EntityViewSource.FilterDescriptors>
                    <!-- Products with CategoryID equal to FilterDescriptor.Value. -->
                    <c1:FilterDescriptor Operator="IsEqualTo" PropertyPath="CategoryID" />
                </c1:EntityViewSource.FilterDescriptors>
            </c1:EntityViewSource>
        </c1:C1DataSource>
        
        <!-- A combo box for choosing product categories. -->
        <ComboBox HorizontalAlignment="Left" Margin="5" Name="comboBox1" Width="221" ItemsSource="{Binding ElementName=c1DataSource1, Path=Categories}" DisplayMemberPath="CategoryName" SelectionChanged="comboBox1_SelectionChanged" />
        <!-- A C1DataGrid showing products of the current category. -->
        <c1:C1DataGrid Grid.Row="1" AutoGenerateColumns="True" Name="dataGrid1" ItemsSource="{Binding ElementName=c1DataSource1, Path=Products}" Margin="0,0,0,23" >
            <!-- 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" Content="Save Changes" Height="23" HorizontalAlignment="Right" Name="button1" Width="102" Click="button1_Click" Margin="0,0,31,10" />
    </Grid>
</Window>
