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

namespace RadGridView_SL4_AR_3
{
	public partial class MainPage : UserControl
	{
		public MainPage()
		{
			InitializeComponent();

			this.gridView.ItemsSource = EmployeeService.GetEmployees();
			this.gridView.GotFocus += new RoutedEventHandler(GridView_GotFocus);
		}

		public string Title = "GridViewDemo";

		private void GridView_GotFocus(object sender, RoutedEventArgs e)
		{
			UIElement element = e.OriginalSource as UIElement;			
			Debug.WriteLine(element.ToString());
		}

	}

	public class Employee
	{
		public string FirstName
		{
			get;
			set;
		}
		public string LastName
		{
			get;
			set;
		}
		public int Age
		{
			get;
			set;
		}
		public bool Married
		{
			get;
			set;
		}
	}

	public class EmployeeService
	{
		public static ObservableCollection<Employee> GetEmployees()
		{
			ObservableCollection<Employee> employees = new ObservableCollection<Employee>();
			Employee employee = new Employee();
			employee.FirstName = "Maria";
			employee.LastName = "Anders";
			employee.Married = true;
			employee.Age = 24;
			employees.Add(employee);
			employee = new Employee();
			employee.FirstName = "Ana";
			employee.LastName = "Trujillo";
			employee.Married = true;
			employee.Age = 44;
			employees.Add(employee);
			employee = new Employee();
			employee.FirstName = "Antonio";
			employee.LastName = "Moreno";
			employee.Married = true;
			employee.Age = 33;
			employees.Add(employee);
			employee = new Employee();
			employee.FirstName = "Thomas";
			employee.LastName = "Hardy";
			employee.Married = false;
			employee.Age = 13;
			employees.Add(employee);
			employee = new Employee();
			employee.FirstName = "Hanna";
			employee.LastName = "Moos";
			employee.Married = false;
			employee.Age = 28;
			employees.Add(employee);
			employee = new Employee();
			employee.FirstName = "Frederique";
			employee.LastName = "Citeaux";
			employee.Married = true;
			employee.Age = 67;
			employees.Add(employee);
			employee = new Employee();
			employee.FirstName = "Martin";
			employee.LastName = "Sommer";
			employee.Married = false;
			employee.Age = 22;
			employees.Add(employee);
			employee = new Employee();
			employee.FirstName = "Laurence";
			employee.LastName = "Lebihan";
			employee.Married = false;
			employee.Age = 32;
			employees.Add(employee);
			employee = new Employee();
			employee.FirstName = "Elizabeth";
			employee.LastName = "Lincoln";
			employee.Married = false;
			employee.Age = 9;
			employees.Add(employee);
			employee = new Employee();
			employee.FirstName = "Victoria";
			employee.LastName = "Ashworth";
			employee.Married = true;
			employee.Age = 29;
			employees.Add(employee);
			return employees;
		}
	}

}
