I couldn't find how to use the SymbolIcon.Symbol to change an appbar icon...
This is to understand what I need to do:
if (SecondaryTile.Exists(ItemId))
{
PinToStart.Icon = "UnPin"; //instead of "Pin"
}
Tha AppBarButton
's Icon is IconElement
type so you cannot just put there a string
. If you want to use a Symbol you can do it like this:
PinToStart.Icon = new SymbolIcon(Symbol.UnPin); //instead of "Pin"
But I've encountered some problems while exchanging only Icons. I'm not sure if they are still there after some updates. If they are, I suggest to exchange the whole `AppBarButton
private AppBarButton pin
{
get
{
AppBarButton temp = new AppBarButton() { Icon = new SymbolIcon(Symbol.Pin) };
temp.Label = "Pin";
temp.Click += Pin_Click;
return temp;
}
}
private AppBarButton unPin
{
get
{
AppBarButton temp = new AppBarButton() { Icon = new SymbolIcon(Symbol.UnPin) };
temp.Label = "UnPin";
temp.Click += UnPin_Click;
return temp;
}
}
Then in the code exchange like this:
(BottomAppBar as CommandBar).PrimaryCommands[0] = pin; // assign the whole button when Pin/unPin
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