Can SfPopup be used as a replacement for DisplayAlert or DisplayActionSheet?

I have a condition in my app where I want the user to make a selection of two options, and then continue the code path based on their selection

 pseud code like this

public async void GetImage()
{

     InitializePermissions();

     if ( await SfPopupTool.Show("<title>", "<Message>", "<LocalFileOption>", "<CameraOption>").ConfigureAwait(true)  == false)
     {
          //Code path to use camera to take picure.  
     }
     else
     {
          //Get Image from local fs
     }
    
     //work with the image and prepare it for use.
}

I want the code to await the user's response, then to continue with their selected path in the code.
I wanted to use the SfPopup since I could use some icons and make the accept and decline options more graphical (I am assuming that I can overload the ImageButton click events to the accept and decline members.
Finally I would also like to know if I can display the popup with no buttons available (Using my own graphical controls for the form?)

In summary,
Can I make the popup.show() awaitable? Or in other words, can I use the return of the popup.Show() for flow control of the app?
Can I hide the Accept button?

1 Reply

KK Karthikraja Kalaimani Syncfusion Team February 18, 2020 12:39 PM UTC

Hi Jesse,

Thank you for contacting Syncfusion support.

By using the AcceptCommand and DeclineCommand in PopupView you can write business logic in the Execute method on customized AcceptCommand and DeclineCommand. And also you can customize the Footer of the PopupView by using the SfPopupLayout.PopupView.FooterTemplate property. By default, the AppreanceMode is OneButton which is AcceptButton on PopupView and you can also hide the footer by setting the SfPopupLayout.PopupView.ShowFooter as false. 
 
For more details please refer to the below UG link.

For AcceptCommand

https://help.syncfusion.com/xamarin/popup/popup-events#accept-command

For DeclineCommand

https://help.syncfusion.com/xamarin/popup/popup-events#decline-command

For FooterTemplate

https://help.syncfusion.com/xamarin/popup/layout-customizations#customizing-popup-footer


For Disable the Footer View

https://help.syncfusion.com/xamarin/popup/layout-customizations#popup-without-footer

You can display only the content of the SfPopupLayout, by removing the header and footer by using SfPopupLayout.PopupView.ShowHeader and SfPopupLayout.PopupView.ShowFooter.

https://help.syncfusion.com/xamarin/popup/layout-customizations#popup-without-header-and-footer




We hope this helps, please let us know if need further assistance from us.

Regards,
Karthik Raja 


Loader.
Up arrow icon