Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C# Silverlight move a control

Is it possible to change the parent of a silverlight control? When I tried adding it to the children collection I got an exception.


1 Answers

You cannot assign a control to two different parents, which is probably the error you're seeing. You need to remove the control from it's existing parent before you try and add it to the new parent.

I don't have a compiler on me, but I'd assume the syntax would be something like this:

MyStackPanel1.Children.Remove(SomeControl);
MyStackPanel2.Children.Add(SomeControl);
like image 190
Rachel Avatar answered Mar 31 '26 09:03

Rachel