WP7 上的 ListBox 出现问题 - 发生 System.Windows.Markup.XamlParseException

发布于 2024-11-17 03:45:47 字数 1314 浏览 11 评论 0原文

每个人。 我有一个列表框。当我尝试显示 61 个项目时 - 它运行正常。 但是当它达到 62 个或更多时 - 应用程序会随着

System.Windows.Markup.XamlParseException occurred
  Message= [Line: 0 Position: 0]
  LineNumber=0
  LinePosition=0
  StackTrace:
       at MS.Internal.XcpImports.CheckHResult(UInt32 hr)
       at MS.Internal.XcpImports.FrameworkElement_MeasureOverride(FrameworkElement element, Size availableSize)
       at System.Windows.FrameworkElement.MeasureOverride(Size availableSize)
       at System.Windows.FrameworkElement.MeasureOverride(IntPtr nativeTarget, Single inWidth, Single inHeight, Single& outWidth, Single& outHeight)
       at MS.Internal.XcpImports.MeasureNative(IntPtr element, Single inWidth, Single inHeight)
       at MS.Internal.XcpImports.UIElement_Measure(UIElement element, Size availableSize)
       at System.Windows.UIElement.Measure(Size availableSize)
       at System.Windows.Controls.VirtualizingStackPanel.MeasureChild(UIElement child, Size layoutSlotSize)
       at System.Windows.Controls.VirtualizingStackPanel.MeasureOverride(Size constraint)
       at System.Windows.FrameworkElement.MeasureOverride(IntPtr nativeTarget, Single inWidth, Single inHeight, Single& outWidth, Single& outHeight)

它是什么而掉落 - 我不知道.. 它会在随机的时刻掉落。我可以将 listBox 滚动到末尾,查看最后一个元素,当我向后滚动时 - 它会抛出错误。

everyone.
I got a listBox. When I try to show 61 items - it runs OK.
But when it's 62 or more - apps falls with

System.Windows.Markup.XamlParseException occurred
  Message= [Line: 0 Position: 0]
  LineNumber=0
  LinePosition=0
  StackTrace:
       at MS.Internal.XcpImports.CheckHResult(UInt32 hr)
       at MS.Internal.XcpImports.FrameworkElement_MeasureOverride(FrameworkElement element, Size availableSize)
       at System.Windows.FrameworkElement.MeasureOverride(Size availableSize)
       at System.Windows.FrameworkElement.MeasureOverride(IntPtr nativeTarget, Single inWidth, Single inHeight, Single& outWidth, Single& outHeight)
       at MS.Internal.XcpImports.MeasureNative(IntPtr element, Single inWidth, Single inHeight)
       at MS.Internal.XcpImports.UIElement_Measure(UIElement element, Size availableSize)
       at System.Windows.UIElement.Measure(Size availableSize)
       at System.Windows.Controls.VirtualizingStackPanel.MeasureChild(UIElement child, Size layoutSlotSize)
       at System.Windows.Controls.VirtualizingStackPanel.MeasureOverride(Size constraint)
       at System.Windows.FrameworkElement.MeasureOverride(IntPtr nativeTarget, Single inWidth, Single inHeight, Single& outWidth, Single& outHeight)

What can it be - I have no clue.. It falls out in a random moment. I can scroll listBox to end, see last element, and when I scroll back - it throw error.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

星星的轨迹 2024-11-24 03:45:47

您的列表框中很可能有可变高度的项目。您可以尝试将 ListBox.ItemsPanel 更改为 StackPanel 而不是 VirtualizingStackPanel。这将允许可变高度的项目,但需要权衡,因为如果列表中有很多项目,那么您将增加启动时间和内存使用量。

You most likely have variable-height items in your listbox. You can try changing the the ListBox.ItemsPanel to be a StackPanel instead of the VirtualizingStackPanel. This will allow variable height items, but there is a tradeoff because if you have a lot of items in the list then you are going to increase startup time and memory usage.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文