Nested SfPopup and SfPopup with webview (ClosePopupOnBackButtonPressed = true ) is not working

Hi,
On Android :

The ClosePopupOnBackButtonPressed = true   is working only for the last SfPopup when the SfPoup is nested (when opening SfPopup from an SfPopup)

SfPopup2 is closing when I press the physical back button.
SfPopup1 is not closing when I press the physical back button.

Can you please help me with this issue.



Also On Adroid when I have SfPopup with webView inside ClosePopupOnBackButtonPressed = true   is not working afrer a postback from the webview
SfPopup is not closing when I press the physical back button.

Can you please help me with this issue.




1 Reply 1 reply marked as answer

KK Karthikraja Kalaimani Syncfusion Team December 1, 2020 02:55 PM UTC

Hi Tito,

You can close the close the opened popup by overriding OnBackButtonPressed method of the page. So, this method will trigger whenever the device back button pressed.  Please refer to the below code snippet.

Code snippet :

 
        PopupPage popupLayout; 
        public MainPage() 
        { 
            InitializeComponent(); 
            popupLayout = new PopupPage(); 
            popupLayout.ClosePopupOnBackButtonPressed = true; 
            popupLayout.BindingContext = this.viewModel; 
        } 
 
        protected override bool OnBackButtonPressed() 
        { 
            popupLayout.IsOpen = false; 
            return base.OnBackButtonPressed(); 
        } 

We hope this helps. Kindly revert us if you have any concerns.

Regards,
Karthik Raja

 


Marked as answer
Loader.
Up arrow icon