How to place a long Grid in a WPF Layout Container?
When I place a Datagrid in a WPF Grid Layout container, the datagrid lengthens the Grid Layout. I want it to occupy only t开发者_Python百科he space available on screen.
Make sure your Grid.ColumnDefinition or Grid.RowDefinition's Width or Height is not set to Auto. If you set it to a fixed size or a star size then the row/column should not resize.
If you're still having problems a code sample would be useful.
You should place your Datagrid into a ScrollViewer, and the ScrollViewer into your Grid cell.
the grid is placed inside a tabitem. I tried the scrollviewer. but the only thing that happens: the scrollviewer gets as large as the too long datagrid.
as the tabitem can vary in height, I would rather not like to specify a fixed height for the grid.
精彩评论