diff --git a/src/Avalonia.Controls/ProgressBar.cs b/src/Avalonia.Controls/ProgressBar.cs index af152cf247..a42d793ff1 100644 --- a/src/Avalonia.Controls/ProgressBar.cs +++ b/src/Avalonia.Controls/ProgressBar.cs @@ -24,6 +24,9 @@ namespace Avalonia.Controls private static readonly StyledProperty IndeterminateStartingOffsetProperty = AvaloniaProperty.Register(nameof(IndeterminateStartingOffset)); + private static readonly StyledProperty IndeterminateEndingOffsetProperty = + AvaloniaProperty.Register(nameof(IndeterminateEndingOffset)); + private Border _indicator; static ProgressBar() @@ -53,6 +56,12 @@ namespace Avalonia.Controls set => SetValue(IndeterminateStartingOffsetProperty, value); } + private double IndeterminateEndingOffset + { + get => GetValue(IndeterminateEndingOffsetProperty); + set => SetValue(IndeterminateEndingOffsetProperty, value); + } + /// protected override Size ArrangeOverride(Size finalSize) { @@ -79,12 +88,15 @@ namespace Avalonia.Controls var width = bounds.Width / 5.0; IndeterminateStartingOffset = -width; _indicator.Width = width; + IndeterminateEndingOffset = bounds.Width; + } else { var height = bounds.Height / 5.0; - IndeterminateStartingOffset = -height; + IndeterminateStartingOffset = -bounds.Height; _indicator.Height = height; + IndeterminateEndingOffset = height; } } else diff --git a/src/Avalonia.Themes.Default/ProgressBar.xaml b/src/Avalonia.Themes.Default/ProgressBar.xaml index df735e2048..c4cbfed350 100644 --- a/src/Avalonia.Themes.Default/ProgressBar.xaml +++ b/src/Avalonia.Themes.Default/ProgressBar.xaml @@ -7,11 +7,9 @@ - - - + @@ -19,12 +17,10 @@