To start with, it's good to understand WPF
content model:
Question about MCTS exam[
^].
First of all, you need to have some
UIElement
in your control which itself can have children, so you could add your label to it. Look at the abstract class
System.Windows.Controls.Panel
:
http://msdn.microsoft.com/en-us/library/system.windows.controls.panel.aspx[
^],
http://msdn.microsoft.com/en-us/library/system.windows.controls.panel.children.aspx[
^].
You need to choose appropriate non-abstract derived class, to have a panel you can insert in your control:
http://msdn.microsoft.com/en-us/library/system.windows.controls.panel.aspx#inheritanceContinued[
^].
Typically, it will be
Grid
or
DockPanel
, and you will insert your label like
myPanel.Children.Add(x)
. Location/layout and other properties of this parent-child relationships depends on the concrete panel class which you will be able to find in its documentation, but it's good to understand the functionality and the use of
dependency properties:
http://msdn.microsoft.com/en-us/library/ms752914.aspx[
^].
—SA