public LinkedManager(string themename)
 {
     SfSkinManager.SetTheme(this, new Theme()
     {
         ThemeName = themename
     });
     InitializeComponent();
     this.Closed += LinkedManager_Closed;
     this.Loaded += (sender, args) =>
     {
         if (count == 0)
         {
             count++;
             windowlist.Add(this);
             this.Left = 50;
             this.Top  = 100;
             LinkedManager linkedManager = new LinkedManager(themename);
             linkedManager.Title = "Docking Manager " + count;
             linkedManager.Owner = this;
             linkedManager.Show();
             windowlist.Add(linkedManager);
             linkedManager.Left = 700;
             linkedManager.Top  = 100;
             this.clientdockingManager.AddToTargetManagersList(linkedManager.clientdockingManager);
             linkedManager.clientdockingManager.AddToTargetManagersList(this.clientdockingManager);
         }
     };
 }
        private void LinkedManager_Closed(object sender, EventArgs e)
        {
            LinkedManager MainWindow = sender as LinkedManager;

            windowlist.Remove(MainWindow);
            if (windowlist.Count == 0)
            {
                count = 0;
            }
        }
        /// <summary>
        /// Handles the Click event of the NewDockingWindow control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.Windows.RoutedEventArgs"/> instance containing the event data.</param>
        private void NewDockingWindow_Click(object sender, RoutedEventArgs e)
        {
            count++;
            LinkedManager linkedManager = new LinkedManager(SfSkinManager.GetTheme(this).ThemeName);

            linkedManager.Title = "Docking Manager " + count;
            linkedManager.Owner = this;
            linkedManager.Show();
            windowlist.Add(linkedManager);
            linkedManager.Left = 400;
            linkedManager.Top  = 200;
        }
        private void LinkedManager_Closed(object sender, EventArgs e)
        {
            LinkedManager MainWindow = sender as LinkedManager;

            windowlist.Remove(MainWindow);
            if (MainWindow.clientdockingManager != null)
            {
                MainWindow.clientdockingManager.Dispose();
                MainWindow.clientdockingManager = null;
            }
            if (windowlist.Count == 0)
            {
                count = 0;
            }
        }
        /// <summary>
        /// Handles the Click event of the RemoveFromTargetManagerList control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.Windows.RoutedEventArgs"/> instance containing the event data.</param>

        private void RemoveFromTargetManagerList_Click(object sender, RoutedEventArgs e)
        {
            if (windowlist.Count > 0)
            {
                for (int i = 0; i < windowlist.Count; i++)
                {
                    LinkedManager window = windowlist[i] as LinkedManager;
                    if (!window.Title.Equals(this.Title))
                    {
                        this.clientdockingManager.RemoveFromTargetManagersList(window.clientdockingManager);
                        window.clientdockingManager.RemoveFromTargetManagersList(this.clientdockingManager);
                    }
                }
            }
        }
        /// <summary>
        /// Handles the Click event of the AddToTargetManagerList control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.Windows.RoutedEventArgs"/> instance containing the event data.</param>
        private void AddToTargetManagerList_Click(object sender, RoutedEventArgs e)
        {
            MenuItem menuitem = sender as MenuItem;

            if (menuitem.IsChecked)
            {
                menuitem.IsChecked = false;
            }
            else
            {
                menuitem.IsChecked = true;
            }

            if (menuitem.IsChecked)
            {
                for (int i = 0; i < windowlist.Count; i++)
                {
                    LinkedManager window = windowlist[i] as LinkedManager;
                    if (!window.Title.Equals(this.Title))
                    {
                        this.clientdockingManager.AddToTargetManagersList(window.clientdockingManager);
                        window.clientdockingManager.AddToTargetManagersList(this.clientdockingManager);
                    }
                }
            }
            else
            {
                for (int i = 0; i < windowlist.Count; i++)
                {
                    LinkedManager window = windowlist[i] as LinkedManager;
                    if (!window.Title.Equals(this.Title))
                    {
                        this.clientdockingManager.RemoveFromTargetManagersList(window.clientdockingManager);
                        window.clientdockingManager.RemoveFromTargetManagersList(this.clientdockingManager);
                    }
                }
            }
        }