<UserControl
  x:Class="Orders.AllOrders"
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  xmlns:local="clr-namespace:Orders"
  xmlns:c1="http://schemas.componentone.com/winfx/2006/xaml"
  >
    <Grid Margin="5">
        <Grid.RowDefinitions>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <c1:C1DataSource Name="dataSource" ContextType="local:NORTHWNDEntities">
            <!-- An EntityViewSource of Order Details in Virtual Mode. -->
            <c1:EntityViewSource AutoLoad="True" EntitySetName="Order_Details" VirtualMode="Managed" PageSize="100"/>
        </c1:C1DataSource>

        <DataGrid Grid.Row="1" AutoGenerateColumns="False" ItemsSource="{Binding ElementName=dataSource, Path=Order_Details}">
            <DataGrid.Columns>
                <DataGridTextColumn Header="OrderID" Binding="{Binding OrderID}" />
                <DataGridTextColumn Header="ProductID" Binding="{Binding ProductID}" />
                <DataGridTextColumn Header="Quantity" Binding="{Binding Quantity}" />
                <DataGridTextColumn Header="UnitPrice" Binding="{Binding UnitPrice, StringFormat=c}" />
                <DataGridTextColumn Header="Discount" Binding="{Binding Discount}" />
            </DataGrid.Columns>
            <!-- A control handler that manages virtual mode in this DataGrid. -->
            <c1:C1DataSource.ControlHandler>
                <c1:ControlHandler VirtualMode="True"/>
            </c1:C1DataSource.ControlHandler>
        </DataGrid>
    </Grid>
</UserControl>