带有 AutoCompleteBox 的 DataGrid 在滚动时会使 Silverlight 崩溃
我有一个带有 DataGrid 的 Silverlight 4 应用程序。数据网格的行包含两个 AutoCompleteBox。
每当 DataGrid 显示滚动条并且用户滚动网格时,整个 Silverlight 插件就会冻结并崩溃。当我从调试器运行它时,我通常会在冻结/崩溃之前收到以下错误:
“错误:Silverlight 应用程序中未处理的错误代码:4009 类别: ManagedRuntimeError 消息: 元素已经是 另一个元素。”
的建议,例如避免使用内联项模板,但我尚未找到可行的解决方案。
我正在寻找与此相关的任何信息:原因、修复、解决方法、进一步分析问题原因的方法,以及任何可能有帮助的内容。
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:
"Error: Unhandled Error in Silverlight Application Code: 4009
Category: ManagedRuntimeError Message: Element is already the child of
another element."
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.
What I'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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我当前正在测试的一种解决方法似乎适用于我的场景,即将 DataGrid 放入 ScrollViewer 中。这有效地使 DataGrid 达到所需的高度,并将滚动委托给 ScrollViewer,因此可以避免任何与 DataGrid 滚动相关的问题。
我发现的唯一缺点(除了它是一个非常难看的解决方法之外):当然,当向下滚动时,DataGrid 的标题行现在会滚动到视图之外。
One workaround that I'm currently testing, and that seems to work in my scenario, is to put the DataGrid inside a ScrollViewer. 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.
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.