I am skinning my app and want have a generic button graphic for all buttons, and then each button have unique content. I've created a DrawingBrush for the generic button graphic and applied it the button's background using a style defined in my resource dictionary. This all works great. However, when I then try to add something other than text to the Content of the button, no content shows up. I just get the background graphic. What do I need to do to have graphical content for both the button's background and content?
+2
A:
If templating, you need to have a ContentPresenter
for displaying the content of the button.
See here for an example on templating a button. In Stage 2, he adds a ContentPresenter to the template. (He actually adds two for a double-effect, but you could just use the simpler one.)
Will Eddins
2009-08-04 21:07:30
Thanks! I got it working. I forgot that in my buttons template I was using a Textblock and not a contentpresenter so that I could have text wrapping.
Dan Vogel
2009-08-04 21:30:31