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;

namespace RadDataFormAndRadGridViewIntegration
{
	public partial class MainPage : UserControl
	{
		public MainPage()
		{
			InitializeComponent();
			this.RadGridView1.ItemsSource = Person.GetSampleListOfPersons();
			
			this.RadDataForm1.EditEnded += new EventHandler<Telerik.Windows.Controls.Data.DataForm.EditEndedEventArgs>(RadDataForm1_EditEnded);
		}

		void RadDataForm1_EditEnded(object sender, Telerik.Windows.Controls.Data.DataForm.EditEndedEventArgs e)
		{
			this.RadDataForm1.Visibility = Visibility.Collapsed;
		}

		private void Edit_Click(object sender, RoutedEventArgs e)
		{
			this.RadGridView1.CurrentItem = ((Button)sender).DataContext;
			this.RadDataForm1.Visibility = Visibility.Visible;
			this.RadDataForm1.BeginEdit();
		}
	}
}
