Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1080
Programatically change image of a ToggleButtonTool
posted

I want to change the image of a ToggleButtonTool according to it's state. I have two GiF-images for that purpose in my project. I use the following code in the event handlers:

Uri src = new Uri(@"Images/FilterOff16x16.gif", UriKind.Relative);
BitmapImage img = new BitmapImage(src);
ToggleButtonRowFilteringOnOff.SmallImage = img;

Unfortunately this does not work. When I look at the BitmapImage object created in the debugger I see 'img.Metadata' threw an exception of type 'System.NotSupportedException' in the Metadata property of the object.

How can I do this properly?

Markus

Parents Reply Children