C# Silverlight move a control
Is it possible to change the parent of a silverligh开发者_StackOverflowt control? When I tried adding it to the children collection I got an exception.
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);
精彩评论