<Window x:Class="TreeGridHybridUsingRowDetails_WPF.Window1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:local="clr-namespace:TreeGridHybridUsingRowDetails_WPF"
	xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
    Title="Window1" Height="300" Width="300">
    <Grid>
		<Grid.Resources>

			<Style x:Key="toggleCellStyle" TargetType="telerik:GridViewCell" >
				<Setter Property="Template">
					<Setter.Value>
						<ControlTemplate TargetType="telerik:GridViewCell">
							<local:IndentedToggleCell/>
						</ControlTemplate>
					</Setter.Value>
				</Setter>
			</Style>
			<DataTemplate x:Key="RowDetailsTemplateLevel2" >
				<telerik:RadGridView x:Name="subgrid" Loaded="subgrid_Loaded"
										 Margin="-2,-1,-1,-2"
										 FrozenColumnCount="1"
										 CanUserFreezeColumns="False"
										 ShowGroupPanel="False"
										 RowIndicatorVisibility="Collapsed"
										 ShowColumnHeaders="False"
										 AutoGenerateColumns="False">
					<telerik:RadGridView.Columns>
						<telerik:GridViewDataColumn CellStyle="{StaticResource toggleCellStyle}"  IsFilterable="False" DataMemberBinding="{Binding FirstName}" Width="200" Header="District / FirstName" IsReadOnly="True"  />
						<telerik:GridViewDataColumn  IsFilterable="False" DataMemberBinding="{Binding Age}" Width="200" Header="ZIP / Age" />
						<telerik:GridViewDataColumn IsFilterable="False" DataMemberBinding="{Binding LastName}" Width="200" Header="State / LastName" />
					</telerik:RadGridView.Columns>
				</telerik:RadGridView>
			</DataTemplate>
			<DataTemplate x:Key="RowDetailsTemplateLevel1" >
				<telerik:RadGridView x:Name="subgrid" Loaded="subgrid_Loaded"
									     RowDetailsTemplate="{StaticResource RowDetailsTemplateLevel2}"
										 Margin="-2,-1,-1,-2"
										 FrozenColumnCount="1"
										 CanUserFreezeColumns="False"
										 ShowGroupPanel="False"
										 RowIndicatorVisibility="Collapsed"
										 ShowColumnHeaders="False"
										 AutoGenerateColumns="False"  >
					<telerik:RadGridView.Columns>
						<telerik:GridViewDataColumn CellStyle="{StaticResource toggleCellStyle}"  IsFilterable="False" DataMemberBinding="{Binding FirstName}" Width="200" Header="District / FirstName" IsReadOnly="True" />
						<telerik:GridViewDataColumn  IsFilterable="False" DataMemberBinding="{Binding Age}" Width="200" Header="ZIP / Age" />
						<telerik:GridViewDataColumn IsFilterable="False" DataMemberBinding="{Binding LastName}" Width="200" Header="State / LastName" />
					</telerik:RadGridView.Columns>
				</telerik:RadGridView>
			</DataTemplate>
		</Grid.Resources>
		<telerik:RadGridView x:Name="RadGridView1" CanUserResizeColumns="False" FrozenColumnCount="1" CanUserFreezeColumns="False" AutoGenerateColumns="False" RowDetailsTemplate="{StaticResource RowDetailsTemplateLevel1}" >
			<telerik:RadGridView.Columns>
				<telerik:GridViewDataColumn CellStyle="{StaticResource toggleCellStyle}" IsFilterable="False" DataMemberBinding="{Binding FirstName}" Width="200" Header="District / FirstName" IsReadOnly="True"  />
				<telerik:GridViewDataColumn  IsFilterable="False" DataMemberBinding="{Binding Age}" Width="200" Header="ZIP / Age" />
				<telerik:GridViewDataColumn IsFilterable="False" DataMemberBinding="{Binding LastName}" Width="200" Header="State / LastName" />
			</telerik:RadGridView.Columns>
		</telerik:RadGridView>
	</Grid>
</Window>
