|
|
@ -156,6 +156,7 @@ namespace Avalonia.Controls |
|
|
MinimumProperty.Changed.AddClassHandler<ProgressBar>((x, e) => x.UpdateIndicatorWhenPropChanged(e)); |
|
|
MinimumProperty.Changed.AddClassHandler<ProgressBar>((x, e) => x.UpdateIndicatorWhenPropChanged(e)); |
|
|
MaximumProperty.Changed.AddClassHandler<ProgressBar>((x, e) => x.UpdateIndicatorWhenPropChanged(e)); |
|
|
MaximumProperty.Changed.AddClassHandler<ProgressBar>((x, e) => x.UpdateIndicatorWhenPropChanged(e)); |
|
|
IsIndeterminateProperty.Changed.AddClassHandler<ProgressBar>((x, e) => x.UpdateIndicatorWhenPropChanged(e)); |
|
|
IsIndeterminateProperty.Changed.AddClassHandler<ProgressBar>((x, e) => x.UpdateIndicatorWhenPropChanged(e)); |
|
|
|
|
|
OrientationProperty.Changed.AddClassHandler<ProgressBar>((x, e) => x.UpdateIndicatorWhenPropChanged(e)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public ProgressBar() |
|
|
public ProgressBar() |
|
|
@ -268,10 +269,18 @@ namespace Avalonia.Controls |
|
|
{ |
|
|
{ |
|
|
double percent = Maximum == Minimum ? 1.0 : (Value - Minimum) / (Maximum - Minimum); |
|
|
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.
|
|
|
if (Orientation == Orientation.Horizontal) |
|
|
if (Orientation == Orientation.Horizontal) |
|
|
|
|
|
{ |
|
|
_indicator.Width = barSize.Width * percent; |
|
|
_indicator.Width = barSize.Width * percent; |
|
|
|
|
|
_indicator.Height = double.NaN; |
|
|
|
|
|
} |
|
|
else |
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
_indicator.Width = double.NaN; |
|
|
_indicator.Height = barSize.Height * percent; |
|
|
_indicator.Height = barSize.Height * percent; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Percentage = percent * 100; |
|
|
Percentage = percent * 100; |
|
|
} |
|
|
} |
|
|
|