<Window x:Class="C1DataSourceBinding.MainWindow"
        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"
        xmlns:c1="http://schemas.componentone.com/winfx/2006/xaml"
        xmlns:my="clr-namespace:C1DataSourceBinding"
        mc:Ignorable="d"
        Title="MainWindow" Height="350" Width="525" Loaded="Window_Loaded">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="auto"/>
            <RowDefinition/>
        </Grid.RowDefinitions>

        <!-- Define a C1DataSource with specified ContextType. View sources are defined inside a C1DataSource. -->
        <c1:C1DataSource Name="c1DataSource1" ContextType="my:NORTHWNDEntities">
            <c1:EntityViewSource EntitySetName="Categories">
                <c1:EntityViewSource.SortDescriptors>
                    <!-- Sort the products by ProductID. -->
                    <c1:SortDescriptor PropertyPath="CategoryName" />
                </c1:EntityViewSource.SortDescriptors>
            </c1:EntityViewSource>
            <!-- A view source of Products. -->
            <c1:EntityViewSource EntitySetName="Products">
                <c1:EntityViewSource.FilterDescriptors>
                    <!-- Display discontinued products only. Perform the filtering on the server. -->
                    <c1:FilterDescriptor Operator="IsEqualTo" PropertyPath="CategoryID" Value="1" />
                </c1:EntityViewSource.FilterDescriptors>
            </c1:EntityViewSource>
        </c1:C1DataSource>

        <StackPanel Orientation="Horizontal">
            <Label Content="Category:"/>
            <ComboBox x:Name="cbxCategory"
                      ItemsSource="{Binding ElementName=c1DataSource1, Path=Categories}"
                      DisplayMemberPath="CategoryName" SelectionChanged="cbxCategory_SelectionChanged"/>
        </StackPanel>
        <c1:C1FlexViewer x:Name="c1FlexViewer" Margin="0,10,0,0" Grid.Row="1" UseAsyncRendering="False"/>
    </Grid>
</Window>
