I have some grid with border (grid name is "maingrid")
Border brd1 = new Border();
this.maingrid.Children.Add(brd1);
SomeClass = new SomeClass(brd1);
Then I have another window with a constructor and with grid too (grid name is "somegrid")
public SomeClass(Border brd2)
{
InitializeComponent();
//i tried to do that: ((Grid)brd2.Parent).Children.Remove(brd2)
//but if i do that, border from "maingrid" removes too
this.somegrid.Children.Add(brd2);
}
How can I remove parents from "brd2" and make this border a child element for "somegrid", but i need to keep "brd1" with "maingrid"?
In short, I need to clone "brd1" with null parent property.