Hello Eeveryone,
I am facing an issue while trying to set Application.Current.MainPage from a ContentPage which is a detail page.
Below is the use case:
I have a Dashboard page which has a ListView with DataTemplate of "ViewCell" type. The code redirects a user to a ContentPage using PushAsync on a button click. Below is the code snippet:
var navigation = (App.Current.MainPage as MasterPage).Detail.Navigation;
Device.BeginInvokeOnMainThread(() =>
{
dialog.Hide(); navigation.PushAsync(new QuestionnairePage());
});
So when navigated back to Dashboard page it breaks the app when below lines of code is executed.
protected async override void OnAppearing()
{
if(!MyBase.IsConnected())
{
Device.BeginInvokeOnMainThread(() =>
{
Application.Current.MainPage = new NoNetworkPage();
});
return;
}
}
Can please anyone suggest me a solution or let me know where i am going wrong.
Regards,
Mehul Bhadricha