I have been trying to figure how to make an image button in Silverlight that can use TemplateBinding to switch out the image. There seems to not be any clear instructions or tutorials out there, but I finally figured it out, so now I would like to share this extremely useful bit of information with you.
Below is a video/screencast of how to do it, but first I will just give you a brief description.
- Create a button
- Edit Template Style
- Put and image inside the Content Presenter
- In the XAML, select the Image and change it's Source to "{TemplateBinding Content}"
- Back on the main stage, type the image path inside of the Content field (Properties Panel)
- That's it (to add text, go back in the button and add a TextBox or ContentPresenter and set it's TemplateBinding to the "Tag" field and enter text there from the main stage