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

namespace RadGridViewWpf_2009_Q210
{
    /// <summary>
    /// Interaction logic for Window1.xaml
    /// </summary>
    public partial class Window1 : Window
    {
        private ObservableCollection<Message> messages = new ObservableCollection<Message>();

        public Window1()
        {
            InitializeComponent();

            RadGridView1.ItemsSource = this.messages;
        }

        private void Button_Click(object sender, RoutedEventArgs e)
        {
            Message newMessage = new Message();
            newMessage.Sender = "New" + this.messages.Count.ToString();
            newMessage.Size = this.messages.Count;
            newMessage.Subject = "New" + this.messages.Count.ToString();

            this.messages.Add(newMessage);
        }

        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            this.RadGridView1.Columns.Add(new GridViewDataColumn() { DataMemberPath = "Sender" });
        }
    }
}
