WPF button with graphics for both the button's background and content

1.3k Views Asked by At

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?

1

There are 1 best solutions below

1
On BEST ANSWER

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.)