I have an object of an UIElement
, how can I remove the parent of it?
I saw that there is not setter for parent property of an UIElement
.
Any suggestions will be helpful.
EDIT :
protected FrameworkElement Content
{
get { return this.content; }
set
{
if ((this.content != null) && (this.Children.Contains(this.content)
== true))
this.Children.Remove(this.content);
this.content = value;
if ((this.content != null) && (this.Children.Contains(this.content)
== false))
{
this.Children.Add(this.content); // here i get error Element is already an child of another
}
this.InvalidateMeasure();
this.InvalidateArrange();
}
}