-
Notifications
You must be signed in to change notification settings - Fork 675
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ProgressBar track height is not overridable #9010
Labels
area-Progress
ProgressBar, ProgressRing
bug
Something isn't working
team-Controls
Issue for the Controls team
Comments
For those who needs a quick workaround until this issue gets fixed, something like this seems to work so far: public class CustomProgressBar : ProgressBar
{
private long _heightPropertyChangedCallBackToken;
public CustomProgressBar () : base()
{
Loaded += OnLoaded;
Unloaded += OnUnloaded;
}
private void OnLoaded(object sender, RoutedEventArgs e)
{
_heightPropertyChangedCallBackToken = RegisterPropertyChangedCallback(HeightProperty, OnHeightPropertyChanged);
ApplyHeight();
}
private void OnUnloaded(object sender, RoutedEventArgs e)
{
UnregisterPropertyChangedCallback(HeightProperty, _heightPropertyChangedCallBackToken);
}
private void ApplyHeight()
{
// FindDescendants() is from the CommunityToolkit.WinUI.Extensions NuGet package.
foreach (FrameworkElement element in this.FindDescendants()
.OfType<FrameworkElement>()
.Where(x => x is Grid or Rectangle))
{
element.Height = Height;
}
}
private void OnHeightPropertyChanged(DependencyObject sender, DependencyProperty dp)
{
ApplyHeight();
}
} |
That's way simple if you won't change the So, we can do: <Grid>
<Grid.Resources>
<x:Double x:Key="ProgressBarTrackHeight">50</x:Double>
</Grid.Resources>
<ProgressBar
MinHeight="{StaticResource ProgressBarTrackHeight}"
Maximum="100"
Value="70" />
</Grid> Thanks! |
bpulliam
added
area-Progress
ProgressBar, ProgressRing
team-Controls
Issue for the Controls team
labels
Oct 26, 2023
Thanks for reporting this. Closing issue now that there's a MinHeight workaround. |
microsoft-github-policy-service
bot
added
the
needs-triage
Issue needs to be triaged by the area owners
label
Jul 22, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
area-Progress
ProgressBar, ProgressRing
bug
Something isn't working
team-Controls
Issue for the Controls team
Describe the bug
The
ProgressBar
track height is not overridable.For example, the code below should render a
ProgresBar
with a track that fills (or almost fills) the green border,but renders this instead:
Steps to reproduce the bug
Use the code above.
Expected behavior
ProgressBarTrackHeight
should be applied to the track height.Screenshots
No response
NuGet package version
WinUI 3 - Windows App SDK 1.4.2: 1.4.231008000
Windows version
No response
Additional context
This issue was supposed to be fixed by #6061.
The text was updated successfully, but these errors were encountered: