Reputation: 109
In my app, on initializing a page (let's call it FirstPage
) I check for some conditions and, if necessary, want to display a warning page (let's call it WarningPage
). The content of this page will be too complicated for Alert Boxes - with links and some formatting.
I tried to call Shell.Current.GoToAsync("WarningPage");
but I did not find the appropriate moment to do this. If called in OnAppearing()
, WarningPage
shows up after I close MainPage
.
What I want is that the navigation stack contains FirstPage
-> WarningPage
-> (perhaps a third page by clicking on a link in WarningPage
) and he gets back to FirstPage
when he closes the WarningPage
.
Edit: No errors occur in MainPage but WarningPage
shows up after I close MainPage
.
Upvotes: 0
Views: 105
Reputation: 109
it is not completely what I indended but I can live with a solution as decribed here.
Now the next question arises: In my solution the rest of the page is shifted down. I would like to have covered the remaining page by this popup.
This will be the next question in ths forum.
Upvotes: 0
Reputation: 109
I seemed to solve it, but not for all cases: I use the Appearing
event in FirstPage
:
public FirstPage()
{
InitializeComponent();
this.Appearing += FirstPage_Appearing;
}
In this event I useNavigation.PushModalAsync
:
private void FirstPage_Appearing(object sender, System.EventArgs e)
{
Navigation.PushModalAsync(new WarningPage());
}
This does what I want but not really:
This works only for one of my pages, unfortunately not for the page where I actually need this feature. So - who can tell me a way that always works to programmatrically switch from one page to a second one and allow to use the Back function to go back to the first page?
When I have time, I'll try to find out under what circumstances it works and what I have to do otherwise.
Upvotes: 0