Browse Source
Merge pull request #9371 from comesx4/fix-progressbar-indicator-size-issue
Indicator size calculation should care about the ProgressBar's Padding property setting
pull/9620/head
Max Katz
4 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
3 additions and
2 deletions
-
src/Avalonia.Controls/ProgressBar.cs
|
|
|
@ -270,15 +270,16 @@ namespace Avalonia.Controls |
|
|
|
double percent = Maximum == Minimum ? 1.0 : (Value - Minimum) / (Maximum - Minimum); |
|
|
|
|
|
|
|
// When the Orientation changed, the indicator's Width or Height should set to double.NaN.
|
|
|
|
// Indicator size calculation should consider the ProgressBar's Padding property setting
|
|
|
|
if (Orientation == Orientation.Horizontal) |
|
|
|
{ |
|
|
|
_indicator.Width = barSize.Width * percent; |
|
|
|
_indicator.Width = (barSize.Width - _indicator.Margin.Left - _indicator.Margin.Right) * percent; |
|
|
|
_indicator.Height = double.NaN; |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
_indicator.Width = double.NaN; |
|
|
|
_indicator.Height = barSize.Height * percent; |
|
|
|
_indicator.Height = (barSize.Height - _indicator.Margin.Top - _indicator.Margin.Bottom) * percent; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|