Reputation: 785
We are using the MAUI CommunityToolkit to open a popup as described here https://learn.microsoft.com/en-us/dotnet/communitytoolkit/maui/views/popup
How can we on Android listen to the back button and close the Popup whenever the user clicks the Back button (hardware button on device). We have tried this method as described here Reset xamarin.forms.shell to initial page on back button but cannot get that to work on a CommunityToolkit popup.
Upvotes: 1
Views: 247
Reputation: 608
How can we on Android listen to the back button
public partial class ContentPageTEST : ContentPage
{
public ContentPageTEST ()
{
InitializeComponent();
}
protected override bool OnBackButtonPressed()
{
// YOUR CODE TO CLOSE PopUp
//...
//...
return base.OnBackButtonPressed();
}
}
Upvotes: -1