<UserControl x:Class="DataSourceSamples.CustomColumns"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" xmlns:c1="http://schemas.componentone.com/winfx/2006/xaml"
             xmlns:local="clr-namespace:DataSourceSamples">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition />
            <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>

        <!-- The EntityViewSource in this C1DataSource is a used as a base for a live view with custom fields defined in code. -->
        <c1:C1DataSource Name="c1DataSource1" ContextType="local:NORTHWNDEntities">
            <c1:EntityViewSource EntitySetName="Products" />
        </c1:C1DataSource>

        <c1:C1DataGrid Grid.Row="0" AutoGenerateColumns="True" Margin="10,10,0,0" Name="dataGrid1" />

        <!-- A button that adds a new product. -->
        <StackPanel Grid.Row="1" Orientation="Horizontal" HorizontalAlignment="Right">
            <Button Width="70" Margin="0,10,5,5" Click="addItem">Add</Button>
        </StackPanel>
    </Grid>
</UserControl>
