I get the following error in a Silverlight application. But I can’t understand what the problem is. If I debug it, then it does not break into anything in the code, it just fails in this callstack structure with only the frame code. Is there a way to get more information about which part of the Silverlight application is the problem in this case.
Message: Sys.InvalidOperationException: ManagedRuntimeError error # 4004 in control 'Xaml1': System.InvalidOperationException: Element is already the child of another element.
at MS.Internal.XcpImports.CheckHResult (UInt32 hr)
at MS.Internal.XcpImports.Collection_AddValue [T] (PresentationFrameworkCollection`1 collection, CValue value)
at MS.Internal.XcpImports.Collection_AddDependencyObject [T] (PresentationFrameworkCollection`1 collection, DependencyObject value)
at System.Windows.PresentationFrameworkCollection`1.AddDependencyObject (DependencyObject value)
at System.Windows.Controls.UIElementCollection.AddInternal (UIElement value)
at System.Windows.PresentationFrameworkCollection`1.Add (T value)
at System.Windows.Controls.AutoCompleteBox.OnApplyTemplate ()
at System.Windows.FrameworkElement.OnApplyTemplate (IntPtr nativeTarget)
XAML for AutoCompeletBox, which is in context:
<tk:AutoCompleteBox
x:Name="acName"
Grid.Row="0"
Grid.Column="1"
LostFocus="acName_LostFocus"
Height="20"
Width="80"
HorizontalAlignment="Left"/>
Erica source
share