Click here to Skip to main content
15,884,917 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
AppBarButton lost function (doesn't execute it's code) after changing it's Label and Icon (the code work only for first click on button but doesn't work any more(after the change)) for example :

In this code mediaPlayer.Pause(); works

C#
private async void AppBarButton_Click_1(object sender, RoutedEventArgs e)
{
   //PPB.Icon = new SymbolIcon(Symbol.Play);
   //PPB.Label = "Preview";
   mediaPlayer.Pause(); //(i tested many other codes also)
}

but in this code mediaPlayer.Pause(); not

C#
private async void AppBarButton_Click_1(object sender, RoutedEventArgs e)
{
   PPB.Icon = new SymbolIcon(Symbol.Play);
   PPB.Label = "Preview";
   mediaPlayer.Pause();
}


What I have tried:

I didn't have tried anything else
Posted
Updated 26-May-19 21:08pm
v2
Comments
Richard Deeming 29-May-19 12:05pm    
NB: Your method doesn't await anything, so there's no need to make it async.
ahmed walid 29-May-19 20:14pm    
This is only part of code other code need it async

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900