Change c4f roundButton image in runtime
I have a
<c4fControls:RoundButton ImageSource="/Images/appbar.transport.play.rest.png" HorizontalAlignment="Left" BorderBrush="CornflowerBlue" Tap="OnPlayTrack" />
and when fires OnPlayTrack
i want to change imageSource
to "/Images/appbar.transport.pause.rest.png"
, but I'm doing something wrong. I tried (in event)
Button bt = sender as Button; BitmapImage image = new BitmapImage(new Uri(@"/Images/appbar.transport.pause.rest.png", UriKind.Relative)); bt.Content = image;
but then I saw that Content
has string type, and this is not what I need. I tried to find ImageSource
in bt
, but there is no properties which show ImageSource
. So, how can I change the image in this button?
Answer:
Coding4Fun.Phone.Controls.RoundButton bt = sender as Coding4Fun.Phone.Controls.RoundButton; bt.ImageSource = new BitmapImage(new Uri(@"/Images/appbar.transport.pause.rest.png", UriKind.Relative));
Answers & Comments...
No comments:
Post a Comment
Send us your comment related to the topic mentioned on the blog