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 Telerik.Windows.Controls.GridView.Settings;

namespace WPF.LoadSave
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        RadGridViewSettings settings = null;

        public MainWindow()
        {
            InitializeComponent();
            this.DataContext = (from c in Enumerable.Range(0, 10) select new SampleData { ID = c, Name = "Name" + c }).ToList();
            this.Loaded += Example_Loaded;
        }

        void Example_Loaded(object sender, EventArgs e)
        {
            settings = new RadGridViewSettings(SampleGrid);
        }


        private void Button_Click(object sender, RoutedEventArgs e)
        {
            if (settings != null)
            {
                settings.LoadState();
            }
        }

        private void SaveButton_Click(object sender, RoutedEventArgs e)
        {
            if (settings != null)
            {
                settings.SaveState();
            }
        }
    }

    public class SampleData
    {
        public int ID { get; set; }
        public string Name { get; set; }

    }
}
