Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Button event in Display Action Sheet

I created display action sheet in Xamarin forms with the following code ,

DisplayActionSheet ("ActionSheet: Send to?", "Cancel", null, "Email", "Twitter", "Facebook");

Is it possible to set button event for Email,Twitter,Facebook?

like image 256
Balaji Avatar asked Dec 08 '14 10:12

Balaji


Video Answer


1 Answers

DisplayAction returns Task<string>, in order not to block the main thread. To handle selection you need to use it in a way similar to this:

            var action = await DisplayActionSheet ("ActionSheet: Send to?", "Cancel", null, "Email", "Twitter", "Facebook");
            switch (action){
            case "Email": 
                DoSomething(); 
                break;
            case "Twitter": 
                DoSomethingElse(); 
                break;
                ...                 
            }
like image 185
Chris Staerkel Avatar answered Sep 29 '22 06:09

Chris Staerkel