Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

Xamarin.Forms: Press back button from code

$
0
0

Hey,

is there a way in Xamarin.Forms to press the back button from code? I tried to call OnBackButtonPressed and SendBackButtonPressed but this does not work. The OnBackButtonPressed Event is called but the back action does not perform.

Call OnBackButtonPressed:

if (_currentQuestionnaireGroup != null)
   await RefreshDataAsync();
else
{
   App.QuestionnaireOverviewPage.IsDirty = true;
   this.OnBackButtonPressed();
}

Event:

protected override bool OnBackButtonPressed()
{
    if (_questionnaireHandler != null)
        App.QuestionnaireOverviewPage.IsDirty = true;

    return base.OnBackButtonPressed();
return true; //tried this also
}

If i press the hardware back button on android the OnBackButtonPressed is also called but this performs the real back action.

Thanks.


Viewing all articles
Browse latest Browse all 204402

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>