using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Collections.ObjectModel;
using System.ComponentModel;

namespace SilverlightApplication2
{

	public class People : ObservableCollection<Person>
	{
		public static string pathXMan = @"John\Mike\X-Man";
		public static string PathSeparator = @"\";

		public People()
		{
			Person John = new Person("John");
			Add(John);
			Person Mike = new Person("Mike");
			John.Children.Add(Mike);
			Mike.Children.Add(new Person("X-Man"));
			Person Sue = new Person("Sue");
			Add(Sue);
			Sue.Children.Add(new Person("Peter"));
		}
	}

	public class Person : INotifyPropertyChanged
	{
		private string name;
		private ObservableCollection<Person> children = new ObservableCollection<Person>();

		public Person(string name)
			
		{
			this.name = name;
		}

		public string Name
		{
			get
			{
				return this.name;
			}
			set
			{
				if (this.name != value)
				{
					this.name = value;
					OnNotifyPropertyChanged("Name");
				}
			}
		}

		public ObservableCollection<Person> Children
		{
			get
			{
				return this.children;
			}
			set
			{
				if (this.children != value)
				{
					this.children = value;
					OnNotifyPropertyChanged("Children");
				}
			}
		}

		#region INotifyPropertyChanged Members

		public event PropertyChangedEventHandler PropertyChanged;
		private void OnNotifyPropertyChanged(string propertyName)
		{
			if (PropertyChanged != null)
			{
				PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
			}
		}

		#endregion
	}
}
