I'm trying to do a pause/play button windows 10 app.
So far I know 3 ways to set the button using
button.context = "some segoe code" - works fine when I initialize it with the button but on the code to change the context the button appears as a bunch of squares
Button symbolicon - works fine initializing but no idea how to alter the symbolicon value outside of button declaration
button uri - only thing I could find online about button changing, but I don't have the button libraries that come in windows phone...
what is your recommendations so on clickrelease the button changes to either the pause or the play
I have used SymbolIcon to achieve the toggle play/pause.
XAML:
<Button Click="play_Click">
<SymbolIcon x:Name="play" Symbol="Play"/>
</Button>
C# code behind:
private void play_Click(object sender, RoutedEventArgs e)
{
if (play.Symbol.Equals(Symbol.Play))
{
play.Symbol = Symbol.Pause;
}
else if (play.Symbol.Equals(Symbol.Pause))
{
play.Symbol = Symbol.Play;
}
}
Comment if you encounter any issues.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With