DataGrid does not display scroll bar issues in WPF

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.