Beispiel #1
0
        private void ReorderCheckButtons()
        {
            // Clear out the child list
            _viewLayout.Clear();

            // Always add the filler as the first item
            _viewLayout.Add(_oldRoot);

            VisualOrientation     checkButtonOrient = ResolveButtonOrientation();
            RelativePositionAlign alignment         = Navigator.Stack.StackAlignment;
            Orientation           stackOrient       = Navigator.Stack.StackOrientation;
            Orientation           buttonEdgeOrient  = (stackOrient == Orientation.Vertical ? Orientation.Horizontal : Orientation.Vertical);
            ViewDockStyle         dockNear          = (stackOrient == Orientation.Vertical ? ViewDockStyle.Top : ViewDockStyle.Left);
            ViewDockStyle         dockFar           = (stackOrient == Orientation.Vertical ? ViewDockStyle.Bottom : ViewDockStyle.Right);

            // Start stacking from the top/left if not explicitly set to be far aligned
            bool dockTopLeft = (alignment != RelativePositionAlign.Far);

            // Add back the pages in the order they are in collection
            foreach (KryptonPage page in Navigator.Pages)
            {
                // Check that a view element exists for the page
                if (_pageLookup.ContainsKey(page))
                {
                    // Get the associated view elements
                    ViewDrawNavCheckButtonBase checkButton = _pageLookup[page];
                    ViewDrawBorderEdge         buttonEdge  = _buttonEdgeLookup[page];

                    checkButton.Checked     = (Navigator.SelectedPage == page);
                    checkButton.Orientation = checkButtonOrient;
                    checkButton.HasFocus    = (_hasFocus && (Navigator.SelectedPage == page));
                    checkButton.Visible     = page.LastVisibleSet;
                    buttonEdge.Visible      = page.LastVisibleSet;
                    buttonEdge.Orientation  = buttonEdgeOrient;

                    // Add to the child collection with the correct docking style
                    if (dockTopLeft)
                    {
                        _viewLayout.Insert(1, checkButton);
                        _viewLayout.Insert(1, buttonEdge);
                        _viewLayout.SetDock(buttonEdge, dockNear);
                        _viewLayout.SetDock(checkButton, dockNear);
                    }
                    else
                    {
                        _viewLayout.Add(buttonEdge, dockFar);
                        _viewLayout.Add(checkButton, dockFar);
                    }

                    // All entries after the selected page are docked at the bottom/right unless
                    // we have been set to stack near or far, in which case we do not change.
                    if (checkButton.Checked && (alignment == RelativePositionAlign.Center))
                    {
                        dockTopLeft = false;
                    }
                }
            }
        }
Beispiel #2
0
        /// <summary>
        /// Destruct the view hierarchy for this mode.
        /// </summary>
        protected override void DestructCheckItemView()
        {
            // Remove the old root from the canvas
            _layoutPanelDocker.Clear();

            // Must call the base class to perform common actions
            base.CreateCheckItemView();
        }