xaml - WP 8.1 ToggleButton Change Icon when Checked / UnChecked -
i have following xaml code windows phone 8.1 (non silverlight):
<grid> <togglebutton name="togbtn" verticalalignment="center" horizontalalignment="center" checked="togglebutton_onchecked"> <symbolicon symbol="play"></symbolicon> </togglebutton> </grid> the output of above code is:

how can change icon stop icon when toggle button checked , play icon when unchecked?
i thought easy find through google, apparently not.
any appreciated.
please change xaml this:
<grid> <togglebutton x:name="togbtn" horizontalalignment="center" verticalalignment="center" checked="togglebutton_checked" unchecked="togglebutton_unchecked"> <symbolicon symbol="play"></symbolicon> </togglebutton> </grid> and please add .cs file:
private void togglebutton_checked(object sender, routedeventargs e) { togbtn.content = new symbolicon(symbol.stop); } private void togglebutton_unchecked(object sender, routedeventargs e) { togbtn.content = new symbolicon(symbol.play); } that should job!
Comments
Post a Comment