using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Telerik.Windows.Controls.GridView;

namespace Hierarchy_WPF
{
	/// <summary>
	/// Interaction logic for ChildGrid.xaml
	/// </summary>
	public partial class ChildGrid : UserControl
	{
		public ChildGrid()
		{
			InitializeComponent();
		}

		private void RadGridView1_RowLoaded(object sender, RowLoadedEventArgs e)
		{
			GridViewRow row = e.Row as GridViewRow;

			MyObject rowItem = e.DataElement as MyObject;

			if (row != null && rowItem != null)
			{
				if (rowItem.Items.Count<MyObject>() > 0)
					row.IsExpandable = true;
				else
					row.IsExpandable = false;
			}
		}
	}
}
