Click here to Skip to main content
14,268,096 members
Rate this:
Please Sign up or sign in to vote.
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

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

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, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100