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 WpfApplication6
{
	/// <summary>
	/// Interaction logic for MainWindow.xaml
	/// </summary>
	public partial class MainWindow : Window
	{
		public MainWindow()
		{
			InitializeComponent();
			this.radGridView.ItemsSource = this.CreateItemsSource(10);
			this.radGridView.KeyDown += new KeyEventHandler(radGridView_KeyDown);
		}

		void radGridView_KeyDown(object sender, KeyEventArgs e)
		{
			if (e.Key == Key.F5)
			{
				MessageBox.Show(string.Format("F5 is pressed! and sender is {0}", sender));
			}
		}

		private ObservableCollection<Person> CreateItemsSource(int count)
		{
			ObservableCollection<Person> persons = new ObservableCollection<Person>();
			for (int i = 0; i < count; i++)
			{
				persons.Add(new Person()
				{
					FirstName = "Joe " + i, LastName = "Rockhead " + i, Age = i
				});
			}
			return persons;
		}

		private void Button_Click(object sender, RoutedEventArgs e)
		{

		}
	}
}
