Dev 控件DevExpress.Wpf.Grid.InfiniteGridSizeException

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."

解决方法:



The problem is that the DXGrid has an infinite height.

To fix, set the height to something non-infinite.

Snoop is absolutely invaluable for this:

Dev 控件DevExpress.Wpf.Grid.InfiniteGridSizeException

If the "Height" for the XAML element is infinite (i.e. 0 or NaN), you can set it using one of the following:

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

Hint: Use VerticalAlignment="Stretch" if you are a child of a Grid with a <RowDefinition Height="*">, and the Binding RelativeSource... elsewhere if that doesn't work.

原文链接:https://stackoverflow.com/questions/37431448/devexpress-wpf-grid-infinitegridsizeexception-was-unhandled