UWP page close

Madhu 96 Reputation points


In our UWP app, there are certain pages which we need to get working like a Modal. Mainly when it comes to closing it, we need to maintain the status of the previous page as it is without reloading it.
We load the next page like this rootFrame.Navigate(typeof(HelpScreen), e.Arguments); Is there a way we can close this and go to the previous page without reloading the previous page. It has to be in the state where it was before navigating to this Page. Is it possible? If so please let me know how to do that.

If that is not possible I think the other option I have is to use AppWindow. I tried that with the samples here.


One issue for our app with that is it creates a separate window, so there are 2 windows in the app. But it'll be good if we can do it without creating another window.
Anyway if this is the only option and if I go with that there is another issue. Our app is running in FullScreen.

ApplicationView.PreferredLaunchWindowingMode = ApplicationViewWindowingMode.FullScreen;

When it is in full screen mode and when I close the second window, the main window is minimized. Can you please tell me how to have it opened like in non full screen mode.

UPDATE : Our client doesn't like opening another window. He wants to have the second screen also opening in the same windows. So is there an option to close a page which we navigates using rootFrame.Navigate(typeof(HelpScreen), e.Arguments); without refreshing the previous page on close? I don't think we can use a content dialog. This is a full page with grids and other components inside it.

Thank you very much.

Universal Windows Platform (UWP)
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Nico Zhu (Shanghai Wicresoft Co,.Ltd.) 12,861 Reputation points

    In our UWP app, there are certain pages which we need to get working like a Modal.

    Derive from official document ,

    Dialogs are modal UI overlays that provide contextual app information. Dialogs block interactions with the app window until being explicitly dismissed. They often request some kind of action from the user.

    For creating dialog control please refer this tutorial . For example:

    private async void DisplayNoWifiDialog()  
        ContentDialog noWifiDialog = new ContentDialog  
            Title = "No wifi connection",  
            Content = "Check your connection and try again.",  
            CloseButtonText = "Ok"  
        ContentDialogResult result = await noWifiDialog.ShowAsync();  

    And you could also use Popup control to implement modal page effect. The following is PopupControl that use to show a modal page.

    public sealed partial class PopupControl : UserControl  
        Popup popup;  
        public PopupControl()  
            SystemNavigationManager.GetForCurrentView().BackRequested += ModalPage_BackRequested;  
            Window.Current.CoreWindow.SizeChanged += CoreWindow_SizeChanged;  
        private void CoreWindow_SizeChanged(CoreWindow sender, WindowSizeChangedEventArgs args)  
        private void ModalPage_BackRequested(object sender, BackRequestedEventArgs e)  
        private void UpdateUI()  
            var bounds = Window.Current.Bounds;  
            this.Width = bounds.Width;  
            this.Height = bounds.Height;  
        public void Show()  
            popup = new Popup();  
            popup.Child = this;  
            popup.IsOpen = true;  
        public void Close()  
            if (popup.IsOpen)  
                popup.IsOpen = false;  
                SystemNavigationManager.GetForCurrentView().BackRequested -= ModalPage_BackRequested;  
                Window.Current.CoreWindow.SizeChanged -= CoreWindow_SizeChanged;  
        private void ClosePopupClicked(object sender, RoutedEventArgs e)  


    alt text


     PopupControl p = new PopupControl();  
    1 person found this answer helpful.