开发者

C# Silverlight move a control

开发者 https://www.devze.com 2023-04-11 15:09 出处:网络
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 pare

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);
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号