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.Shapes;
using Telerik.Windows.Controls.GridView;
using Telerik.Windows.Data;
using Samples.Shared;
using System.Collections.ObjectModel;

namespace Samples.GridView.SimulatedUnboundMode
{
    /// <summary>
    /// Interaction logic for MainPage.xaml
    /// </summary>
    public partial class MainPage : UserControl
    {
        private ObservableCollection<Message> data = new ObservableCollection<Message>();

        public MainPage()
        {
            InitializeComponent();

            // bind the grid to an empty collection
            this.radGridView.ItemsSource = data;
        }

        private void Button_Click(object sender, RoutedEventArgs e)
        {
            // we add items to the data source (not to the grid) to simulate unbound mode

            Message newItem = new Message();
            newItem.Sender = "newItem";

            this.data.Add(newItem);
        }
    }
}
