What you need to know here is the WPF
content model:
http://msdn.microsoft.com/en-us/library/bb613548.aspx[
^].
If you look at it, you will see that, for example,
System.Windows.Controls.Button
is derived from the class
System.Windows.Controls.ContentControl
, and, hence, it's content is "a single arbitrary object":
http://msdn.microsoft.com/en-us/library/system.windows.controls.button.aspx[
^].
Your class derived from
System.Windows.Controls.UserControl
and, hence, also from the class
System.Windows.Controls.ContentControl
. Please see:
http://msdn.microsoft.com/en-us/library/system.windows.controls.contentcontrol.aspx#inheritanceContinued[
^],
http://msdn.microsoft.com/en-us/library/system.windows.controls.usercontrol.aspx[
^].
It means that, basically, it is considered in the content model pretty much as the button; it's content is already "a single arbitrary object". What more "custom" would you need? And your custom control class also inherits the
Content
property. You don't need to make it more "custom" because it is already "custom enough":
http://msdn.microsoft.com/en-us/library/system.windows.controls.contentcontrol.content.aspx[
^].
However, in practice, to make you
Content
working with the WPF UI properly, you should not make the content totally arbitrary. In most cases, developers of the user controls use some class of
Panel
as the content, more exactly, one of the classes derived from
Panel
; and the panel holds some other UI Elements:
http://msdn.microsoft.com/en-us/library/system.windows.controls.panel.aspx#inheritanceContinued[
^],
http://msdn.microsoft.com/en-us/library/system.windows.uielement.aspx[
^].
Any problems?
—SA