using System;
using System.Collections.Generic;
using System.Linq;
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.Reflection;
using System.Globalization;
using C1.Silverlight;

namespace C1_Demo
{
	public partial class DemoComboBox 
		: UserControl
	{
		#region Object model

		public bool IsEnabled
		{
			get
			{
				return comboText.IsEnabled;
			}
			set
			{
				comboText.IsEnabled = value;
			}
		}

		public bool IsEditable
		{
			get
			{
				return comboText.IsEditable;
			}
			set
			{
				comboText.IsEditable = value;
			}
		}

		public bool AutoComplete
		{
			get
			{
				return comboText.AutoComplete;
			}
			set
			{
				comboText.AutoComplete = value;
			}
		}

        public Condition Condition
        {
            get
            {
                return comboText.Condition;
            }
            set
            {
                comboText.Condition = value;
            }
        }

		public double DropDownWidth
		{
			get
			{
				return comboText.DropDownWidth;
			}
			set
			{
				comboText.DropDownWidth = value;
			}
		}

		public double DropDownHeight
		{
			get
			{
				return comboText.DropDownHeight;
			}
			set
			{
				comboText.DropDownHeight = value;
			}
		}

        public CornerRadius CornerRadius
        {
            get
            {
                return comboText.CornerRadius;
            }
            set
            {
                comboText.CornerRadius = value;
            }
        }

		#region ** ClearStyle properties

		public Brush DEMO_Background 
		{
			get 
			{
				return comboText.Background;
			}
			set 
			{
				comboText.Background = value;
			}
		}

		public Brush DEMO_Foreground
		{
			get
			{
				return comboText.Foreground;
			}
			set
			{
				comboText.Foreground = value;
			}
		}

		public Brush DEMO_BorderBrush
		{
			get
			{
				return comboText.BorderBrush;
			}
			set
			{
				comboText.BorderBrush = value;
			}
		}

		public Brush MouseOverBrush
		{
			get
			{
				return comboText.MouseOverBrush;
			}
			set
			{
				comboText.MouseOverBrush = value;
			}
		}

		public Brush PressedBrush
		{
			get
			{
				return comboText.PressedBrush;
			}
			set
			{
				comboText.PressedBrush = value;
			}
		}

		public Brush SelectedBackground
		{
			get
			{
				return comboText.SelectedBackground;
			}
			set
			{
				comboText.SelectedBackground = value;
			}
		}

		public Brush FocusBrush
		{
			get
			{
				return comboText.FocusBrush;
			}
			set
			{
				comboText.FocusBrush = value;
			}
		}

		public Brush CaretBrush
		{
			get
			{
				return comboText.CaretBrush;
			}
			set
			{
				comboText.CaretBrush = value;
			}
		}

		public Brush SelectionBackground
		{
			get
			{
				return comboText.SelectionBackground;
			}
			set
			{
				comboText.SelectionBackground = value;
			}
		}

		public Brush SelectionForeground
		{
			get
			{
				return comboText.SelectionForeground;
			}
			set
			{
				comboText.SelectionForeground = value;
			}
		}

		public Brush ButtonBackground
		{
			get
			{
				return comboText.ButtonBackground;
			}
			set
			{
				comboText.ButtonBackground = value;
			}
		}

		public Brush ButtonForeground
		{
			get
			{
				return comboText.ButtonForeground;
			}
			set
			{
				comboText.ButtonForeground = value;
			}
		}
		
		#endregion

		#endregion

		#region Constructor

		public DemoComboBox()
		{
			Width = 200;

			InitializeComponent();

            comboText.Items.Add("Alabama");
            comboText.Items.Add("Alaska");
            comboText.Items.Add("American Samoa");
            comboText.Items.Add("Arizona");
            comboText.Items.Add("Arkansas");
            comboText.Items.Add("California");
            comboText.Items.Add("Colorado");
            comboText.Items.Add("Connecticut");
            comboText.Items.Add("Delaware");
            comboText.Items.Add("District of Columbia");
            comboText.Items.Add("Florida");
            comboText.Items.Add("Georgia");
            comboText.Items.Add("Guam");
            comboText.Items.Add("Hawaii");
            comboText.Items.Add("Idaho");
            comboText.Items.Add("Illinois");
            comboText.Items.Add("Indiana");
            comboText.Items.Add("Iowa");
            comboText.Items.Add("Kansas");
            comboText.Items.Add("Kentucky");
            comboText.Items.Add("Louisiana");
            comboText.Items.Add("Maine");
            comboText.Items.Add("Maryland");
            comboText.Items.Add("Massachusetts");
            comboText.Items.Add("Michigan");
            comboText.Items.Add("Minnesota");
            comboText.Items.Add("Mississippi");
            comboText.Items.Add("Missouri");
            comboText.Items.Add("Montana");
            comboText.Items.Add("Nebraska");
            comboText.Items.Add("Nevada");
            comboText.Items.Add("New Hampshire");
            comboText.Items.Add("New Jersey");
            comboText.Items.Add("New Mexico");
            comboText.Items.Add("New York");
            comboText.Items.Add("North Carolina");
            comboText.Items.Add("North Dakota");
            comboText.Items.Add("Northern Marianas Islands");
            comboText.Items.Add("Ohio");
            comboText.Items.Add("Oklahoma");
            comboText.Items.Add("Oregon");
            comboText.Items.Add("Pennsylvania");
            comboText.Items.Add("Puerto Rico");
            comboText.Items.Add("Rhode Island");
            comboText.Items.Add("South Carolina");
            comboText.Items.Add("South Dakota");
            comboText.Items.Add("Tennessee");
            comboText.Items.Add("Texas");
            comboText.Items.Add("Utah");
            comboText.Items.Add("Vermont");
            comboText.Items.Add("Virginia");
            comboText.Items.Add("Virgin Islands");
            comboText.Items.Add("Washington");
            comboText.Items.Add("West Virginia");
            comboText.Items.Add("Wisconsin");
            comboText.Items.Add("Wyoming");

			// selection change
			comboText.SelectedIndexChanged += new EventHandler<PropertyChangedEventArgs<int>>(comboText_SelectedIndexChanged);
		}

		void comboText_SelectedIndexChanged(object sender, PropertyChangedEventArgs<int> e)
		{
			if (SelectedItemChanged != null)
				SelectedItemChanged(comboText, e);
		}

		#endregion

		public event EventHandler SelectedItemChanged;
	}
}
