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

namespace AddRemovePanesInTheDocumentHost
{
    /// <summary>
    /// Interaction logic for Window1.xaml
    /// </summary>
    public partial class Window1 : Window
    {
        List<RadPane> panes;
        public Window1()
        {
            InitializeComponent();
            panes = new List<RadPane>();
        }

        private void ButtonAdd_Click(object sender, RoutedEventArgs e)
        {
            var pane = new RadPane();
            panes.Add(pane);

            DocumentHostGroup.Items.Add(pane);
        }

        private void ButtonRemove_Click(object sender, RoutedEventArgs e)
        {
            if (panes.Count > 0)
            {
                panes[0].RemoveFromParent();
                panes.RemoveAt(0);
            }
        }
    }
}
