在UWP C#项目中更改AppBarButton的图标和标签后,它失去了功能

时间:2019-05-26 15:18:10

标签: c# function xaml button uwp

AppBarButton更改了LabelIcon后,该函数丢失了功能(不执行它的代码)(该代码仅适用于第一次单击按钮,而不再起作用(更改后) ),例如:

在此代码中,mediaPlayer.Pause();有效

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)
}

但在此代码mediaPlayer.Pause();中不是

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

0 个答案:

没有答案