I am aware I can reference styles & templates from a resource dictionary and I make significant use of them. But what about complete controls?
I can declare a fully defined WPF control, like a button, within the app.xaml as a resource. For example, the app.xaml file defining a button would contain this:
<Button x:Key="HelpButton" Content="?" />
But how can reference it within the xaml markup of a user control so that the button is rendered?
EDIT:
In response to the question of “Why would you want to?” I agree that a button isn’t an excellent example (it’s just an easy one to describe).
What about a polygon (not a control, I know) that you declare in app.xaml and want to use in multiple xaml files?
You can’t, and to be honest, I’m not sure why you’d want to. That button is one button, meaning that it can only be in one place (at one time); given that, it makes sense to define a new button in every place you need it. As you’ve already discovered, that’s what template resources are for.
(When I say that you can’t, I mean that it’s not supported in plain XAML; it’s conceivable you could implement
IValueConverterin a class that returns the button, and bind it in XAML to the content of a content control. And of course, you could use code to add and remove the button programatically from different containers as necessary. Neither seems like a great option.)