dotnet / dotnet/wpf

ProgressBar Inside ListView Breaks Resizing

Open
#7,399 0 comments 4 reactions 1 assignee Claimed by @anjaligupta-dev View on GitHub
Investigate
Dominant language
C#
Stars
7.7k
Forks
1.3k
Avg merge
1d 11h
Merged PRs (30d)
61

Description

.NET Core Version: .NET 7.0
Windows version: Windows 10 Version 21H2 Build 19044.2364
Does the bug reproduce also in WPF for .NET Framework 4.8?: Yes

Problem description:
A ProgressBar placed inside a ListViewItem causes the containing ListView resizing to break if the ProgressBar Value is set to its Maximum value or higher. Opened a technical support incident with Microsoft (TrackingID#2209070060001448) regarding this issue and they also believe it to be a bug.

Actual behavior:
ProgressBar/ListViewItem expands to use the available space when container width increases; however, when the container width decreases the ProgressBar/ListViewItem does not contract and a scroll bar appears, but only if its Value is set to Maximum or higher. Once the scroll bar appears, it will not disappear until the container size exceeds the size where the scroll bar originally appeared. The ProgresssBar/ListViewItem resumes expansion into the available space as the container is sized even larger, but again refuses to contract if the container size shrinks once again.

Expected behavior:
The ProgressBar/ListViewItem should contract when its container shrinks (down to its MinWidth value if set) if its Value is equal to or greater than its Maximum, just like it does when its Value is less than Maximum.

Minimal repro:
Create a new WPF App with default settings and replace the empty Grid tag with the XAML below; run the application and repeatedly resize the window wider and narrower to see the problem behavior on the left side and the expected behavior on the right side (simulated using a StackPanel):
``` XAML



<Setter Property="Height"
Value="25" />


<Setter Property="Padding"
Value="0" />
<Setter Property="BorderThickness"
Value="0" />























```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.