开发者

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜