New to Telerik UI for WPFStart a free 30-day trial

How-to: Set properties to the child gridview

Updated on Sep 24, 2025

Usually, you create the gridview hierarchy by using the TableDefinition and adding it to the ChildTableDefinitions collection of RadGridView.

This article will show how to access and set different properties, in code behind, of the child gridview. Follow the steps below in order to achieve a child gridview which does not have a group panel and does not have auto-generated columns:

Telerik WPF DataGrid how to child grid

  1. Subscribe to the DataLoading event of the parent gridview
XAML
	<telerik:RadGridView Name="employeeRadGridView" 
	             ItemsSource="{Binding Employees}" 
	             DataLoading="employeeRadGridView_DataLoading">
	    <!-- ... -->
	</telerik:RadGridView>
  1. In the event handler of the DataLoading event check the ParentRow property of the sender object:
C#
	private void employeeRadGridView_DataLoading(object sender, GridViewDataLoadingEventArgs e)
	{
	    GridViewDataControl dataControl = (GridViewDataControl)sender;
	    if (dataControl.ParentRow != null)
	    {
	        //dataControl is the child gridview
	        dataControl.ShowGroupPanel = false;
	        GridViewDataColumn column = new GridViewDataColumn();
	        column.DataMemberBinding = new Binding("EmployeeID");
	        dataControl.Columns.Add(column);
	        column = new GridViewDataColumn();
	        column.DataMemberBinding = new Binding("FirstName");
	        dataControl.Columns.Add(column);
	        column = new GridViewDataColumn();
	        column.DataMemberBinding = new Binding("LastName");
	        dataControl.Columns.Add(column);
	        column = new GridViewDataColumn();
	        column.DataMemberBinding = new Binding("Title");
	        dataControl.Columns.Add(column);
	    }
	}

As an alternative, you can use the HierarchyChildTemplate and put RadGridView in its DataTemplate - this way you can set the properties directly to the gridview:

XAML
	<telerik:RadGridView Name="gridView" ItemsSource="{Binding Person}">
	    <telerik:RadGridView.ChildTableDefinitions>
	        <telerik:GridViewTableDefinition />
	    </telerik:RadGridView.ChildTableDefinitions>
	    <telerik:RadGridView.HierarchyChildTemplate>
	        <DataTemplate>
	            <telerik:RadGridView ItemsSource="{Binding Children}" Name="childGrid" ShowGroupPanel="False" />
	        </DataTemplate>
	    </telerik:RadGridView.HierarchyChildTemplate>
	</telerik:RadGridView>

See Also

In this article
See Also
Not finding the help you need?
Contact Support