0
votes

This is the XAML code for a simple toggle button in Windows Phone 8.1.

<ToggleButton Content="Text_Here" />

How can we show an icon for the same Toggle Button??

2

2 Answers

1
votes

First you can try if the AppBarToggleButton fits your needs. It toggles an Icon.

Else, you have to edit the ControlTemplate for the ToggleButton. (In Designer: Right click it, got Edit Template -> Edit a Copy).

The default Template features two content presenters for enabled and disabled content, which you can replace to display your icons.

1
votes

ToggleButton has ContentPresenter inside - you can put most of things into it for example icon:

<ToggleButton>
     <SymbolIcon Symbol="Message"/>
</ToggleButton>

or Image if you want:

<ToggleButton>
     <Image Source="image.jpg"/>
</ToggleButton>

or any Panel, Button another ToggleButton and so on.

You can also play with its Style and Enabled/Disabled Content.