<UserControl x:Class="DataGridSamples.CustomRows"
      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:local="clr-namespace:DataGridSamples"
      xmlns:helpers="clr-namespace:Helpers"
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
      mc:Ignorable="d" 
      d:DesignHeight="300" d:DesignWidth="300">
    <UserControl.Resources>
        <ResourceDictionary>
            <DataTemplate x:Key="TemplateRow">
                <Grid Height="100">
                    <Grid.Resources>
                        <local:ImageSourceConverter x:Key="ImageConverter"/>
                        <c1:ColorConverter x:Key="ColorConverter"/>
                    </Grid.Resources>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="106"/>
                        <ColumnDefinition/>
                    </Grid.ColumnDefinitions>
                    <Rectangle Fill="White" Margin="12,27,14,23"/>
                    <Image Margin="12,27,14,23" Source="{Binding ImageUrl, Converter={StaticResource ImageConverter}, ConverterParameter='/DataGridSamples.4;component/Resources/'}" Height="50" Width="80"/>
                    <Image Margin="8,23,10,19" Height="58" Width="88" Source="/DataGridSamples.4;component/Resources/ImageBorder.png"/>
                    <Grid Grid.Column="1">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="*"/>
                            <RowDefinition Height="*"/>
                            <RowDefinition Height="*"/>
                            <RowDefinition Height="*"/>
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="110" MaxWidth="110"/>
                            <ColumnDefinition Width="*"/>
                            <ColumnDefinition Width="110" MaxWidth="110"/>
                            <ColumnDefinition Width="*"/>
                        </Grid.ColumnDefinitions>
                        <TextBlock Text="Product Number :" TextWrapping="Wrap" VerticalAlignment="Center"/>
                        <TextBlock TextWrapping="Wrap" VerticalAlignment="Center" Grid.Row="1"><Run Text="Name "/><Run Text=":"/></TextBlock>
                        <TextBlock TextWrapping="Wrap" VerticalAlignment="Center" Grid.Row="2"><Run Text="Standard Cost"/><Run Text=":"/></TextBlock>
                        <TextBlock TextWrapping="Wrap" VerticalAlignment="Center" Grid.Row="3"><Run Text="Available"/><Run Text=":"/></TextBlock>
                        <Line Grid.ColumnSpan="2" Height="1" VerticalAlignment="Bottom"  Margin="0,0,8,0" X2="1" Stroke="#56B1C3D4" Stretch="Fill"/>
                        <Line Grid.ColumnSpan="2" Grid.Row="1" Height="1" VerticalAlignment="Bottom"  Margin="0,0,8,0" X2="1" Stroke="#56B1C3D4" Stretch="Fill"/>
                        <Line Grid.ColumnSpan="2" Grid.Row="2" Height="1" VerticalAlignment="Bottom"  Margin="0,0,8,0" X2="1" Stroke="#56B1C3D4" Stretch="Fill"/>
                        <TextBlock TextWrapping="Wrap" Text="{Binding ProductNumber}" VerticalAlignment="Center" Grid.Column="1" HorizontalAlignment="Left"/>
                        <TextBlock TextWrapping="Wrap" Text="{Binding Name, Mode=OneWay}" VerticalAlignment="Center" Grid.Column="1" Grid.Row="1" HorizontalAlignment="Left"/>
                        <TextBlock TextWrapping="Wrap" Text="{Binding StandardCost, Mode=OneWay}" Grid.Column="1" Grid.Row="2" VerticalAlignment="Center" HorizontalAlignment="Left"/>
                        <TextBlock TextWrapping="Wrap" Text="{Binding Available, Mode=OneWay}" VerticalAlignment="Center" Grid.Column="1" Grid.Row="3" HorizontalAlignment="Left"/>
                        <TextBlock Text="Expiration Date:" TextWrapping="Wrap" VerticalAlignment="Center" Grid.Column="2"/>
                        <TextBlock TextWrapping="Wrap" VerticalAlignment="Center" Grid.Column="2" Grid.Row="1"><Run Text="Color"/><Run Text=":"/></TextBlock>
                        <TextBlock TextWrapping="Wrap" VerticalAlignment="Center" Grid.Column="2" Grid.Row="2"><Run Text="Description"/><Run Text=":"/></TextBlock>
                        <TextBlock TextWrapping="Wrap" Text="{Binding ExpirationDate, Mode=OneWay}" VerticalAlignment="Center" Grid.Column="3" HorizontalAlignment="Left"/>
                        <c1:C1CheckeredBorder HorizontalAlignment="Left" Margin="0,4" Background="{Binding Color, Converter={StaticResource ColorConverter}, Mode=OneWay}" Grid.Column="3" Grid.Row="1" Width="44"/>
                        <TextBlock TextWrapping="Wrap" Text="{Binding Description, Mode=OneWay}" VerticalAlignment="Center" Grid.Column="3" Grid.Row="2" HorizontalAlignment="Left"/>
                        <Line Grid.ColumnSpan="2" Grid.Column="2" Height="1" VerticalAlignment="Bottom"  Margin="0,0,8,0" X2="1" Stroke="#56B1C3D4" Stretch="Fill"/>
                        <Line Grid.ColumnSpan="2" Grid.Row="1" Grid.Column="2" Height="1" VerticalAlignment="Bottom"  Margin="0,0,8,0" X2="1" Stroke="#56B1C3D4" Stretch="Fill"/>
                        <Line Grid.ColumnSpan="2" Grid.Row="2" Grid.Column="2" Height="1" VerticalAlignment="Bottom"  Margin="0,0,8,0" X2="1" Stroke="#56B1C3D4" Stretch="Fill"/>
                    </Grid>
                </Grid>
            </DataTemplate>
            <local:ImageSourceConverter x:Key="ImageConverter"/>
        </ResourceDictionary>
    </UserControl.Resources>
    <Grid>
        <c1:C1DataGrid x:Name="grid" 
                       AutoGeneratingColumn="grid_AutoGeneratingColumn"
                       CreatingRow="C1DataGrid_CreatingRow" 
                       BeginningNewRow="grid_BeginningNewRow" 
                       RowHeight="100"
                       CanUserGroup="True"/>
    </Grid>
</UserControl>
