1

I am new to WPF. I have got a DataGrid which is placed inside a Grid with row height set to "*" . I want this DataGrid height to fit to its content if the window height is not less than the total content height of the DataGrid, else show a vertical ScrollViewer. I have tried to surround it with a StackPanel which does the first job, i.e. resizing of the DataGrid height to fit to its content, but at a cost of not showing the vertical ScrollViewer which was appearing when the DataGrid was a direct child of the Grid. How I can achieve the required behaviour?

4

1 回答 1

1

用作Grid您的父容器DataGridVerticalAlignment="Top"为您的DataGrid.

希望能帮助到你。

于 2013-08-02T10:52:36.513 回答