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

namespace RiaServicesExample
{
	public partial class MainPage : UserControl
	{
		DomainDataSource customersDomain;

		public MainPage()
		{
			InitializeComponent();
			this.radGridView.RowEditEnded += this.radGridView_RowEditEnded;
			this.customersDomain = this.radGridView.DataContext as DomainDataSource;
		}

		void radGridView_RowEditEnded(object sender, Telerik.Windows.Controls.GridViewRowEditEndedEventArgs e)
		{
			if (e.EditAction == GridViewEditAction.Commit)
			{
				this.customersDomain.SubmitChanges();
			}
			else
			{
				this.customersDomain.RejectChanges();
			}
		}
	}
}
