WPF Bug list (13) -- the horizontal scroll bar of ListView should appear but not appear

Source: Internet
Author: User

We know that when the content of ListView is out of the control range, the scroll bar is displayed by default. This content should obviously include Head and Items. The horizontal scroll bar should be displayed no matter which part has exceeded.

The Bug of ListView is that when the ListView does not contain items and the total length of Headr exceeds the ListView itself, the horizontal scroll bar does not appear.

This Bug is very reproducible. The Code is as follows:

<Grid x: Name = "LayoutRoot">

& Lt; ListView Width = "100"

<ListView. View>

<GridView>

<GridViewColumn Header = "Name"/>

<GridViewColumn Header = "Value"/>

<GridViewColumn Header = "Length"/>

<GridViewColumn Header = "Format"/>

<GridViewColumn Header = "Error Information"/>

</GridView>

</ListView. View>

</ListView>

</Grid>

Shows the running effect:

This may be the simplest problem I have found, but it is a complicated Bug.

What is the problem? Analyze the XAML Structure of ListView carefully, for example:

In the Template of ListView, we can see that there is no HeaderPresenter in ScrollViewer, but only ItemsPresenter. So where is HeaderPresenter? No error. It is in ScrollViewer. As shown in.

The problem is that the HeaderPresenter in the Template of ScrollViewer does not belong to the Content to be Scroll. Therefore, the ScrollBar of ScrollViewer does not appear when the Header is out of the range. Why does Microsoft put HeaderPresenter in the Template of ScrollViewer?

When you scroll the vertical scroll bar, is it only Items scrolling? And the Header is always at the top? If the Header is used as the Content, the Header will be rolled along with Items. This is a Bug that does not appear larger than the ultra-long Header horizontal scroll bar. Therefore, this is the only option under the existing Control Sets of WPF.

However, the horizontal scroll bar does not appear when there is no Items. It is still a Bug. The solution to this Bug is quite complex and requires the Selective Scrolling function (provided by WPF Toolkit ). Solution. (If I can implement it within my acceptable time ......)

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.