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;

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

		private void alphabetical_list_of_productDomainDataSource_LoadedData(object sender, System.Windows.Controls.LoadedDataEventArgs e)
		{

			if (e.HasError)
			{
				System.Windows.MessageBox.Show(e.Error.ToString(), "Load Error", System.Windows.MessageBoxButton.OK);
				e.MarkErrorAsHandled();
			}
		}

		private void Button_Click(object sender, RoutedEventArgs e)
		{
			gridView1.ItemsSource = PersonService.GetPersonData();
		}
	}

	public class Person
	{
		public string ID { get; set; }
		public string FirstName { get; set; }		
	}

	public class PersonService
	{
		public static List<Person> GetPersonData()
		{
			return new List<Person>()
			{
				new Person { ID = "1", FirstName = "John" },
				new Person { ID = "2", FirstName = "Doe" },
				new Person { ID = "3", FirstName = "Tom" },
				new Person { ID = "4", FirstName = "Smith" },
			};
		}
	}
}
