public static T CreateMDIChild <T>(this DockingManager dm) where T : UserControl, new()
        {
            T mdiChild = null;

            //check if mdi child is already open..select it
            foreach (var form in dm.Children)
            {
                if (form is T)
                {
                    mdiChild = (form as T);
                }
            }

            //if mdi child is not open...open it
            if (mdiChild == null)
            {
                mdiChild = new T();

                DocumentContainer.SetMDIBounds(mdiChild, new Rect(10, 10, 600, 600));
                DockingManager.SetState(mdiChild, DockState.Document);
                dm.Children.Add(mdiChild);
            }

            dm.ActiveWindow = mdiChild;
            return(mdiChild);
        }
        /// <summary>
        /// Method to execute vertical orientation.
        /// </summary>
        private void TileVertical(object parameter)
        {
            double width = documentContainer.ActualWidth / documentContainer.Items.Count - 4;
            double top   = 0.0;
            double left  = 0.0;

            foreach (UIElement element in documentContainer.Items)
            {
                DocumentContainer.SetMDIBounds(element, new Rect(left, top, width, documentContainer.ActualHeight - 3));
                left += width;
            }
        }
        /// <summary>
        /// Method to execute horizontal orientation.
        /// </summary>
        private void TileHorizontal(object parameter)
        {
            double height = documentContainer.ActualHeight / documentContainer.Items.Count - 3;
            double top    = 0.0;
            double left   = 0.0;

            foreach (UIElement element in documentContainer.Items)
            {
                DocumentContainer.SetMDIBounds(element, new Rect(left, top, documentContainer.ActualWidth - 4, height));
                top += height;
            }
        }
        /// <summary>
        /// Method to execute cascade orientation.
        /// </summary>
        private void Cascade(object parameter)
        {
            double top  = 0.0;
            double left = 0.0;

            foreach (UIElement element in documentContainer.Items)
            {
                DocumentContainer.SetMDIBounds(element, new Rect(left, top, 500, 300));
                left += 60;
                top  += 60;
            }
        }
예제 #5
0
        private void TileV()
        {
            MainWindow window = App.Current.MainWindow as MainWindow;
            double     width  = window.MDIView.container.ActualWidth / window.MDIView.container.Items.Count - 4;
            double     top    = 0.0;
            double     left   = 0.0;

            foreach (UIElement element in window.MDIView.container.Items)
            {
                DocumentContainer.SetMDIBounds(element, new Rect(left, top, width, window.MDIView.container.ActualHeight - 3));
                left += width;
            }
        }
예제 #6
0
        private void TileH()
        {
            MainWindow window = App.Current.MainWindow as MainWindow;
            double     height = window.MDIView.container.ActualHeight / window.MDIView.container.Items.Count - 3;
            double     top    = 0.0;
            double     left   = 0.0;

            foreach (UIElement element in window.MDIView.container.Items)
            {
                DocumentContainer.SetMDIBounds(element, new Rect(left, top, window.MDIView.container.ActualWidth - 4, height));
                top += height;
            }
        }
예제 #7
0
        private void Cascade()
        {
            MainWindow window = App.Current.MainWindow as MainWindow;
            double     top    = 0.0;
            double     left   = 0.0;

            foreach (UIElement element in window.MDIView.container.Items)
            {
                DocumentContainer.SetMDIBounds(element, new Rect(left, top, 500, 300));
                left += 60;
                top  += 60;
            }
        }
예제 #8
0
        /// <summary>
        /// Method used to add elements to the Document Container.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void AddElement_Click(object sender, RoutedEventArgs e)
        {
            RichTextBox rtb = new RichTextBox();

            rtb.VerticalScrollBarVisibility = ScrollBarVisibility.Auto;
            DocumentContainer.SetHeader(rtb, "New Window" + i.ToString());
            Rect re = new Rect(30, 30, 300, 300);

            DocumentContainer.SetMDIBounds(rtb, re);
            DocContainer.Items.Add(rtb);
            DocContainer.ActiveDocument = rtb;
            i++;
        }