gpt4 book ai didi

c# - DevExpress.Wpf.Grid.InfiniteGridSizeException 未处理

转载 作者:行者123 更新时间:2023-11-30 13:55:03 26 4
gpt4 key购买 nike

使用 DevExpress 时,我看到此错误:

DevExpress.Wpf.Grid.InfiniteGridSizeException was unhandled Message="By default, an infinite grid height is not allowed since all grid rows will be rendered and hence the grid will work very slowly. To fix this issue, you should place the grid into a container that will give a finite height to the grid, or you should manually specify the grid's Height or MaxHeight. Note that you can also avoid this exception by setting the GridControl.AllowInfiniteGridSize static property to True, but in that case the grid will run slowly."

最佳答案

问题是 DXGrid具有无限高。

要修复,请将高度设置为非无限值。

Snoop 对此绝对是无价的:

enter image description here

如果 XAML 元素的“高度”是无限的(即 0NaN ),您可以使用以下一个设置它:

  • 选项 1:Height="{Binding Path=ActualHeight, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=UIElement}}"
  • 选项 2:VerticalAlignment="Stretch"
  • 选项 3:Height="Auto"

提示:使用 VerticalAlignment="Stretch"如果你是 Grid 的 child 用<RowDefinition Height="*"> , 和 Binding RelativeSource...如果这不起作用,则在其他地方。

但是如果父控件的高度是无限的呢?

如果父控件的高度是无限的,那么我们的问题就更大了。我们必须继续设置每个连续父级的高度,直到我们用非无限 ActualHeight 击中一个控件。 .

附录 A:相关帖子

关于c# - DevExpress.Wpf.Grid.InfiniteGridSizeException 未处理,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37431448/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com