コード例 #1
0
        public virtual void Handle(GoBackPageNavigationRequest message)
        {
            // Remove the top frame
            if (message.ToPage == null)
            {
                StackedFrame.GoBack();
            }
            else
            {
                // ReSharper disable once PossibleUnintendedReferenceComparison
                while (StackedFrame.TopFrame != null && StackedFrame.TopFrame.Content != message.ToPage)
                {
                    StackedFrame.GoBack();
                }
            }

            StackedFrame.EnableTop();
        }
コード例 #2
0
        /// <summary>
        /// Used to navigate to a new Frame, e.g. add a frame with a new page
        /// </summary>
        public Page?AddPage(Page page, Page?basePage = null, bool isResizable = true, bool isModal = true)
        {
            // if a base frame is set, go back to it
            if (basePage != null)
            {
                EventAggregator.PublishMessage(new GoBackPageNavigationRequest(basePage));
            }

            // Check if the frame is already created
            var frameKey = StackedFrameExtension.GetFrameKey(page);

            if (StackedFrame.Contains(frameKey))
            {
                return(null);
            }

            // Hide the current property panel
            HidePropertyPanel();

            // if the page is modal, than disable the previous one
            if (isModal)
            {
                StackedFrame.DisableTop();
            }

            if (StackedMode == StackedMode.FullWidth && isResizable && StackedFrame.TopFrame != null)
            {
                StackedFrame.AddSplitter();
            }

            // add the new page
            var frame = CreateFrame();

            StackedFrame.AddFrame(EventAggregator, frame, page);

            if (StackedMode == StackedMode.Resizeable && isResizable)
            {
                StackedFrame.AddSplitter();
            }

            return(page);
        }