简体   繁体   中英

UWP C#: Returning to ContentDialog from Page

I have navigated from a ContentDialog to a Page in my UWP app written in C#. Now I want to return back to the ContentDialog when I click a button on the Page .

I tried writing (Window.Current.Content as Frame)?.GoBack(); but that only returned to my MainPage (from where my ContentDialog was launched).

If it is possible to perform such an action, what is the correct syntax?

No, you can not navigate to or even from content dialog. What you do is that you are navigating between the pages. Action that you call in your dialog does invoke this navigation ie there would be no difference if it was done with button or button in content dialog - these are just controls on your page.

If you want to see the dialog on MainPage when you navigate back, implement the logic to show it again if certain conditions are met (for example pass NavigationEventArgs containing details whether Content Dialog should be re-opened).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM