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 System.Collections.ObjectModel;

namespace WpfApplication20
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
            testGrid.ItemsSource = new ObservableCollection<Book>() { new Book("Book1"), new Book("Book2"), new Book("Book3") };           
        }
    }

    public class Book
    {
        public string Title { get; set; }
        public ObservableCollection<BookPage> Pages { get; set; }
        public ObservableCollection<BookIndexer> Indexers { get; set; }

        public Book(string title)
        {
            this.Title = title;
            Pages = new ObservableCollection<BookPage>();
            Indexers = new ObservableCollection<BookIndexer>();
            for (int i = 0; i < 10; i++)
            {
                Pages.Add(new BookPage() { Name = String.Format("Page {0}", i) });
                Indexers.Add(new BookIndexer() { Name = String.Format("Indexer {0}", i) });
            }
        }
    }

    public class BookPage
    {
        public string Name { get; set; }
    }

    public class BookIndexer
    {
        public string Name { get; set; }
    }
}
