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;
using Telerik.Windows.Controls;
using Telerik.Windows.Data;

namespace Hierarchy_WPF
{
	public class MyObject
	{
		public int ID { get; set; }

		public string Name { get; set; }

		public int Level { get; set; }

		public IEnumerable<MyObject> Items
		{
			get
			{
				if (ID == 1 || ID == 3 || ID == 5 || ID == 7)
				{
					return (from i in Enumerable.Range(0, 10)
						   select new MyObject()
						   {
							   ID = i,
							   Name = String.Format("{0}", Name + " - " + i.ToString()),
							   Level = Level + 1
						   }).ToList();
				}
				else
					return Enumerable.Empty<MyObject>();
			}
		}
	}
}
