How to change the Segoe MDL2 icon of a button in code behind?

  Kiến thức lập trình

I have a UWP application that contains a button with a Segoe MDL2 icon. I need to change the button icon when it is pressed. Below is the code I am trying to use.

XAML

    <Button x:Name="btnPlayPause" FontFamily="Segoe MDL2 Assets" Content="" Width="50" Height="50" FontSize="26" FontWeight="ExtraBold" Background="Gray" Tapped="btnPlayPause_Tapped"/>

C#

    private async void btnPlayPause_Tapped(object sender, TappedRoutedEventArgs e)
{
   btnPlayPause.Content = "&#xE769";
} 

LEAVE A COMMENT