Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 91519

ToolbarItems throws Cannot implicitly convert type 'System.Threading.Tasks.Task' to 'bool'

$
0
0

Hi,

I am trying to use below code to show a Signout toolbar button which works fine

but when I add a DisplayAlert to it I get:

Error CS0029: Cannot implicitly convert type 'System.Threading.Tasks.Task' to 'bool' (CS0029)

Here is the code:

ToolbarItems.Add(new ToolbarItem("Sign Out", null, () =>
{
    var answer = DisplayAlert("Sign Out", "Would you like to sign out now?", "Yes", "No");

    if (answer)
    {
        Application.Current.Properties.Clear();
        Navigation.PushModalAsync(new NavigationPage(new ZeeraSignin()));
    }
}));

How can I fix this please..

Thanks,
Jassim


Viewing all articles
Browse latest Browse all 91519

Trending Articles



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