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;
using Telerik.Windows.Data;
using System.Collections.ObjectModel;
using Telerik.Windows.Controls.GridView;

namespace WpfApplication28
{
    /// <summary>
    /// Interaction logic for Window1.xaml
    /// </summary>
    public partial class Window1 : Window
    {
       public Window1()
        {
            InitializeComponent();
  
            GridViewTableDefinition detailDefinition = new GridViewTableDefinition();
            detailDefinition.Relation = new PropertyRelation("Orders");
            radGridView1.TableDefinition.ChildTableDefinitions.Add(detailDefinition);
            radGridView1.ItemsSource = BuildCustomers();
        }

        private static ObservableCollection<Customer> BuildCustomers()
        {
            ObservableCollection<Customer> customers = new ObservableCollection<Customer>();

            ObservableCollection<Order> orders = new ObservableCollection<Order>();

            for (int i = 0; i < 10; i++)
            {
                orders.Add(new Order { Number = i, Details = "Order" + i });
            }

            for (int i = 0; i < 100; i++)
            {
                customers.Add(new Customer { Email = "Mail" + i, Name = "Name" + i, Number = i, Orders = orders });
            }

            return customers;
        }

    }
}
