<?xml version="1.0" encoding="utf-8"?>
<UserControl x:Class="C1DataGrid_Demo2010.AddRemoveRows" d:DataContext="{d:DesignData Source=/DesignData/SampleProducts.xaml}" mc:Ignorable="d" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:c1="http://schemas.componentone.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006">
    <UserControl.Resources>
       
        <Style x:Key="NewRowStyle" TargetType="c1:DataGridNewRowPresenter">
            <Setter Property="WatermarkText" Value="Click here to enter a new product" />
        </Style>
    </UserControl.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
			<RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <Border Margin="0 0 0 10">
            <StackPanel Orientation="Horizontal" VerticalAlignment="Center">
                <Button x:Name="btnAdd" Padding="0" Content="Add new Product" Width="140" Height="20" Click="btnAdd_Click" HorizontalAlignment="Left" VerticalAlignment="Center" />
                <RadioButton x:Name="rbnTop" Margin="8,2,0,0" Width="43" Content="Top" GroupName="NewRowVisibility" IsChecked="True" />
                <RadioButton x:Name="rbnBottom" Margin="8,2,0,0" Width="66" Content="Bottom" GroupName="NewRowVisibility" />
            </StackPanel>
        </Border>

        <c1:C1DataGrid x:Name="grid" Grid.Row="1" RowHeight="25" AutoGeneratingColumn="grid_AutoGeneratingColumn" BeginningNewRow="grid_BeginningNewRow" CommittingNewRow="grid_CommittingNewRow" CancelingNewRow="grid_CancelingNewRow" RowsAdded="grid_RowsAdded" RowsDeleted="grid_RowsDeleted" DeletingRows="grid_DeletingRows" NewRowVisibility="Bottom" ItemsSource="{Binding}" NewRowStyle="{StaticResource NewRowStyle}">
            <c1:C1DataGrid.Columns>
                <c1:DataGridTemplateColumn>
                    <c1:DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <Button x:Name="btnRemove" Margin="2" Click="btnRemove_Click" Height="18" Width="18" IsTabStop="False">
                                <Image Source="/C1DataGrid_Demo2010.5;component/Resources/ico-delete.png" Height="12" Width="12" Stretch="Fill" VerticalAlignment="Center" HorizontalAlignment="Center" IsHitTestVisible="False" />
                            </Button>
                        </DataTemplate>
                    </c1:DataGridTemplateColumn.CellTemplate>
                </c1:DataGridTemplateColumn>
            </c1:C1DataGrid.Columns>
            <c1:C1RowIndexHeaderBehavior.RowIndexHeaderBehavior>
                <c1:C1RowIndexHeaderBehavior />
            </c1:C1RowIndexHeaderBehavior.RowIndexHeaderBehavior>
        </c1:C1DataGrid>
    </Grid>
</UserControl>