Please see my comment to the question.
As you try to operate concepts which don't exist, I cannot really know what you really want to do, but it's very likely that you simply want to remove one control and replace it with another one. All question is: where? Alternatively, you can simply hide one control and show another one.
The approach with hiding/showing would be the simplest and perhaps more suitable, especially if you have limited number of such controls. This is how:
UIElement.IsVisible Property (System.Windows)[
1],
UIElement.Visibility Property (System.Windows)[
2].
To add and remove controls, you need too learn something. First of all, you don't just add control; you have to add it to certain parent element, into some point of your
logical tree. Please see:
Trees in WPF[
1],
Trees in WPF[
2],
Trees in WPF[
3],
WPF Content Model[
4],
WPF Content Model[
5],
WPF Content Model[
6].
You don't need to dig in all the detail at once; at first, you only need to grasp the main ideas. Look at the last too links. They describe two major cases you may face with (too bad you did not tell us where your controls should be). In first case, your control is the only element of its parent element, its
Content
. So, typically, you assign the property
Content
of your parent element with one control instance of another; the types of those different controls can also be different; it should understand it from the
content model fundamentals.
There are other cases, you can read about them on the same MSDN page.
The other cases are "Controls That Contain a Collection of Arbitrary Objects". Then you remove one item from collection and add another one to the same collection. Most typical case is the class
ItemsControl
.
…And so on. I cannot and don't want to list all cases here; it's done very nicely on the page I referenced. You just need to get the idea.
—SA