using System.Windows;
using Telerik.Windows.Controls;
using Telerik.Windows.Controls.GridView;

namespace RGV_AutoAddNewRow
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
        }

        private void clubsGrid_RowEditEnded(object sender, GridViewRowEditEndedEventArgs e)
        {
            //RadGridView grid = sender as RadGridView;
            //if (grid.SelectedItem == e.Row.Item && grid.Items.IndexOf(e.Row.Item) == (grid.Items.Count - 1))
            //{
            //    grid.BeginInsert();
            //}
            RadGridView grid = sender as RadGridView;
            if (grid == null)
                return;
            if (grid.Items.IndexOf(e.Row.Item) == (grid.Items.Count - 1) && e.EditOperationType == GridViewEditOperationType.Insert)
            {
                grid.BeginInsert();
            }
        }
    }
}
