<UserControl x:Class="DataGridSamples.Hierarchical"
      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: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>
        <Style x:Key="FirstLevelGrid" TargetType="c1:C1DataGrid">
            <Setter Property="FontSize" Value="14"/>
            <Setter Property="ColumnHeaderHeight" Value="35"/>
            <Setter Property="RowHeaderWidth" Value="35"/>
            <Setter Property="VerticalScrollStep" Value="50"/>
            <Setter Property="Background" Value="#FF415869"/>
            <Setter Property="Foreground" Value="White"/>
            <Setter Property="HeaderBackground" Value="#FF415869"/>
            <Setter Property="HeaderForeground" Value="White"/>
            <Setter Property="BorderBrush" Value="#FF415869"/>
            <Setter Property="SelectedBackground" Value="#C2169EC4"/>
            <Setter Property="MouseOverBrush" Value="#96169EC4"/>
            <Setter Property="AlternatingRowBackground" Value="#FF7F96A1"/>
            <Setter Property="RowBackground" Value="#FF8BA2A7"/>
            <Setter Property="RowForeground" Value="White"/>
            <Setter Property="AlternatingRowForeground" Value="White"/>
            <Setter Property="GridLinesVisibility" Value="All"/>
            <Setter Property="VerticalGridLinesBrush" Value="#66415869"/>
            <Setter Property="HorizontalGridLinesBrush" Value="#66415869"/>
        </Style>
        <Style x:Key="SecondLevelGrid" TargetType="c1:C1DataGrid">
            <Setter Property="FontSize" Value="11"/>
            <Setter Property="ColumnHeaderHeight" Value="25"/>
            <Setter Property="RowHeaderWidth" Value="25"/>
            <Setter Property="Background" Value="#FF5194A5"/>
            <Setter Property="Foreground" Value="White"/>
            <Setter Property="HeaderBackground" Value="#FF5194A5"/>
            <Setter Property="HeaderForeground" Value="White"/>
            <Setter Property="BorderBrush" Value="#FF354B5B"/>
            <Setter Property="BorderThickness" Value="2"/>
            <Setter Property="SelectedBackground" Value="#C255D1F3"/>
            <Setter Property="MouseOverBrush" Value="#96B2E1E4"/>
            <Setter Property="RowBackground" Value="#FFC4D4DA"/>
            <Setter Property="AlternatingRowBackground" Value="#FFBCCED5"/>
            <Setter Property="GridLinesVisibility" Value="All"/>
            <Setter Property="VerticalGridLinesBrush" Value="#66354B5B"/>
            <Setter Property="HorizontalGridLinesBrush" Value="#66354B5B"/>
        </Style>
    </UserControl.Resources>
    <Grid>
        <c1:C1DataGrid x:Name="gridCategories" 
                       Style="{StaticResource FirstLevelGrid}"
                       CanUserAddRows="False"
                       IsReadOnly="True"
                       LoadedRowDetailsPresenter="gridCategories_LoadedRowDetailsPresenter"
                       CurrentCellChanged="grid_CurrentCellChanged"
                       SelectionChanged="grid_SelectionChanged"
                       KeyDown="grid_KeyDown"
                       Grid.Row="1"
                       RowDetailsVisibilityMode="Visible">
            <c1:C1DataGrid.RowDetailsTemplate>
                <DataTemplate>
                    <c1:C1DataGrid x:Name="gridProducts" 
                                   Style="{StaticResource SecondLevelGrid}"
                                   Margin="10"
                                   CanUserAddRows="False"
                                   IsReadOnly="True"
                                   KeyDown="grid_KeyDown"
                                   CurrentCellChanged="grid_CurrentCellChanged"
                                   SelectionChanged="grid_SelectionChanged"
                                   AutoGeneratingColumn="gridProducts_AutoGeneratingColumn"
                                   SelectedIndex="-1"/>
                </DataTemplate>
            </c1:C1DataGrid.RowDetailsTemplate>
        </c1:C1DataGrid>
    </Grid>
</UserControl>
