The DataGrid in WPF is self-contained, and can be displayed with scroll bars when the content is not displayed. However, the DataGrid has been encountered in development and does not display scroll bars. Have encountered similar problems before, once again through the search, found to be the cause of StackPanel, hereby recorded.
Please refer to the following text: http://www.cnblogs.com/lhx880619/archive/2011/12/08/2281420.html
The reason is simpler because the DataGrid is nested in the StackPanel, looking at Microsoft document HTTP://MSDN.MICROSOFT.COM/ZH-CN/LIBRARY/MS754213, It can be seen that StackPanel is actually in the horizontal or vertical direction infinity, causing the DataGrid to think its parent container is infinitely large in the vertical direction, so there is no scroll bar, I believe many people will appear in this situation outside the DataGrid set StackPanel layout bar, so If you want a scroll bar, do not set the StackPanel layout outside the DataGrid remember
DataGrid does not display scroll bar issues in WPF