VirtualizingPanel in DataGrid

后端 未结 1 1714
忘掉有多难
忘掉有多难 2021-01-13 04:53

I\'ve started exploring the Data and UI virtualization features in WPF recently and stumbled upon something strange.

I created a DataGrid\'s with

1条回答
  •  余生分开走
    2021-01-13 05:38

    a StackPanel is an "infinite container" (notice the quotes), in the sense that it does NOT impose a limit in the size of its children, like a Grid or DockPanel does.

    What this means in terms of UI virtualization is that, since your DataGrid is not limited in Height, it will grow endlessly and render all it's items, effectively losing UI virtualization.

    See MSDN: WPF Layout for more details.

    The bottom line is that you need make sure you use the appropiate layout containers, depending on your needs.

    0 讨论(0)
提交回复
热议问题