{"id":1835,"date":"2022-08-30T15:19:50","date_gmt":"2022-08-30T15:19:50","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2013\/12\/02\/datagrid-with-autocompletebox-crashes-silverlight-when-scrolling-collection-of-common-programming-errors\/"},"modified":"2022-08-30T15:19:50","modified_gmt":"2022-08-30T15:19:50","slug":"datagrid-with-autocompletebox-crashes-silverlight-when-scrolling-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2022\/08\/30\/datagrid-with-autocompletebox-crashes-silverlight-when-scrolling-collection-of-common-programming-errors\/","title":{"rendered":"DataGrid with AutoCompleteBox crashes Silverlight when scrolling-Collection of common programming errors"},"content":{"rendered":"<p>I have a Silverlight 4 application with a DataGrid. The rows of the datagrid contain two AutoCompleteBoxes.<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/i.stack.imgur.com\/uLlnJ.png\" \/><\/p>\n<p>Whenever the DataGrid shows a scrollbar and the user scrolls the grid, the entire Silverlight plug-in will freeze and crash. When I run it from the debugger, I usually get the following error right before the freeze\/crash:<\/p>\n<blockquote>\n<p>&#8220;Error: Unhandled Error in Silverlight Application Code: 4009 Category: ManagedRuntimeError Message: Element is already the child of another element.&#8221;<\/p>\n<\/blockquote>\n<p>I have seen several suggestions on possibly related issues on the silverlight.net forums, like avoiding inline item templates, but I have not yet found a working solution.<\/p>\n<p>What I&#8217;m looking for is any information related to this: causes, fixes, work-arounds, methods to further analyse the cause of the problem, anything that could help.<\/p>\n<ol>\n<li>\n<p>One workaround that I&#8217;m currently testing, and that seems to work in my scenario, is to <strong>put the DataGrid inside a ScrollViewer<\/strong>. This effectively makes the DataGrid as high as it needs to be and delegates the scrolling to the ScrollViewer, so any DataGrid-scrolling-related problems are hereby avoided.<\/p>\n<p>The only drawback I have found yet (other than that it is a very ugly workaround): the header row of the DataGrid now scrolls out of view, of course, when scrolling down.<\/p>\n<\/li>\n<\/ol>\n<p id=\"rop\"><small>Originally posted 2013-12-02 20:56:57. <\/small><\/p>","protected":false},"excerpt":{"rendered":"<p>I have a Silverlight 4 application with a DataGrid. The rows of the datagrid contain two AutoCompleteBoxes. Whenever the DataGrid shows a scrollbar and the user scrolls the grid, the entire Silverlight plug-in will freeze and crash. When I run it from the debugger, I usually get the following error right before the freeze\/crash: &#8220;Error: [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1835","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/1835","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=1835"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/1835\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=1835"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=1835"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=1835"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}