November 15th, 2010, 08:58 PM
Toggle Image source using only XAML
This is my first post on CodeGuru - first of many, I hope.
I need some help. I have an assignment where I have to write a WPF application, but I'm only allowed to code in XAML - no C# code. Somehow, using just XAML, I have to make a window application where clicking an image toggles the image source of that image, as well as the source of another image.
So say there are two images: Image1 and Image 2. Initially:
Image1.Source = "A.bmp"
Image2.Source = "B.bmp"
But when Image1 is clicked, the following happens:
Image1.Source = "C.bmp"
Image2.Source = "D.bmp"
And when Image1 is clicked again, the image sources revert to "A" and "B" respectively etc.
Doing this in C# is no problem, but I'm confused as to how it's even possible in XAML. I'm guessing it's something along the lines of using styles and triggers, but I can't get anything to work. Any tips would be very helpful! Thanks!
Click Here to Expand Forum to Full Width
This is a CodeGuru survey question.