using System.ComponentModel;
using System.Collections.ObjectModel;

namespace TriStateModeInDeep
{
	public class SampleBusinessObject : INotifyPropertyChanged
	{
		public SampleBusinessObject(string name)
		{
			this.Name = name;
			this.Items = new ObservableCollection<SampleBusinessObject>();
		}

		public string Name { get; set; }

		private bool? isChecked = false;
		public bool? IsChecked
		{
			get { return this.isChecked; }
			set
			{
				if (this.isChecked != value)
				{
					this.isChecked = value;
					OnPropertyChanged("IsChecked");
				}
			}
		}

		public ObservableCollection<SampleBusinessObject> Items { get; set; }

		public event PropertyChangedEventHandler PropertyChanged;

		protected virtual void OnPropertyChanged(string propertyName)
		{
			if (PropertyChanged != null)
			{
				PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
			}
		}
	}
}