如何处理Element已经是另一个元素的孩子?

时间:2014-01-10 11:51:21

标签: vb.net windows-phone-8

stkpnl = New StackPanel
stkpnl.Children.Add(pan)

mypop = New Popup
mypop.Child = New PopupSubitem
mypop.FlowDirection = System.Windows.FlowDirection.LeftToRight

Dim brd As New Border
brd.BorderBrush = New SolidColorBrush(Colors.Black)
brd.BorderThickness = New Thickness(5.0)
brd.Background = New SolidColorBrush(Colors.Black)
brd.Height = 800
brd.Width = 480
brd.Child = stkpnl

mypop.Child = brd
mypop.VerticalOffset = 250
mypop.HorizontalOffset = 0
mypop.IsOpen = True

我遇到的问题是这段代码

An exception of type 'System.InvalidOperationException' occurred in System.Windows.ni.dll but was not handled in user code

Additional information: Element is already the child of another element.

0 个答案:

没有答案