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;

namespace GridViewColumnSortState
{
	/// <summary>
	/// Interaction logic for Window1.xaml
	/// </summary>
	public partial class Window1 : Window
	{
		public Window1()
		{
			InitializeComponent();

			RadGridView1.ItemsSource = GetData();
		}

		private int current = 0;

		private IEnumerable<Message> GetData()
		{
			var result = from index in Enumerable.Range(current, 10)
					select new Message { Sender = "tom@hanna-barbera.com", Subject = "Subject: " + index, Size = index * 100 };

			current += 10;
			return result;
		}

		private void rebindButton_Click(object sender, RoutedEventArgs e)
		{
			RadGridView1.ItemsSource = null;
			RadGridView1.ItemsSource = GetData();
		}
	}
}
