From 3b317fc3080b183892a4b0c419e7c32d64fe6af5 Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Thu, 28 May 2020 15:58:13 -0300 Subject: [PATCH 01/17] initial progressbar port. --- .../Accents/FluentBaseDark.xaml | 5 + .../Accents/FluentBaseLight.xaml | 6 + .../Accents/FluentControlResourcesDark.xaml | 9 ++ .../Accents/FluentControlResourcesLight.xaml | 8 ++ src/Avalonia.Themes.Fluent/ProgressBar.xaml | 108 ++++++++++++++---- 5 files changed, 116 insertions(+), 20 deletions(-) diff --git a/src/Avalonia.Themes.Fluent/Accents/FluentBaseDark.xaml b/src/Avalonia.Themes.Fluent/Accents/FluentBaseDark.xaml index 7a715bbde7..aed5ac1360 100644 --- a/src/Avalonia.Themes.Fluent/Accents/FluentBaseDark.xaml +++ b/src/Avalonia.Themes.Fluent/Accents/FluentBaseDark.xaml @@ -162,6 +162,11 @@ + + + + + diff --git a/src/Avalonia.Themes.Fluent/Accents/FluentBaseLight.xaml b/src/Avalonia.Themes.Fluent/Accents/FluentBaseLight.xaml index 5c6286a0bc..50d29f44ab 100644 --- a/src/Avalonia.Themes.Fluent/Accents/FluentBaseLight.xaml +++ b/src/Avalonia.Themes.Fluent/Accents/FluentBaseLight.xaml @@ -164,6 +164,12 @@ + + + + + + diff --git a/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesDark.xaml b/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesDark.xaml index 7364c339f1..21181bf19d 100644 --- a/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesDark.xaml +++ b/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesDark.xaml @@ -169,6 +169,15 @@ + + 0.6 + 4 + 0 + + + + + diff --git a/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesLight.xaml b/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesLight.xaml index 15e157f573..8ce75862f1 100644 --- a/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesLight.xaml +++ b/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesLight.xaml @@ -168,6 +168,14 @@ + + 0.6 + 4 + 0 + + + + diff --git a/src/Avalonia.Themes.Fluent/ProgressBar.xaml b/src/Avalonia.Themes.Fluent/ProgressBar.xaml index d3c2f0c784..39a573303c 100644 --- a/src/Avalonia.Themes.Fluent/ProgressBar.xaml +++ b/src/Avalonia.Themes.Fluent/ProgressBar.xaml @@ -1,24 +1,92 @@ - - - + + + + + + + + + + + + - + + + + + + + + + + @@ -68,388 +55,44 @@ - - - - - - - - - - - - - - - - - - - - - - - - - + - + - + + + + + + + From 792405443c808fdaf16bd74ff022fc65338b6d48 Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Wed, 17 Jun 2020 16:43:15 -0300 Subject: [PATCH 09/17] put fields in the correct place. --- src/Avalonia.Controls/ProgressBar.cs | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/src/Avalonia.Controls/ProgressBar.cs b/src/Avalonia.Controls/ProgressBar.cs index cdbafb314f..42cad8acd3 100644 --- a/src/Avalonia.Controls/ProgressBar.cs +++ b/src/Avalonia.Controls/ProgressBar.cs @@ -1,7 +1,4 @@ - -using System; using Avalonia.Controls.Primitives; -using Avalonia.Data; using Avalonia.Layout; using Avalonia.Media; @@ -12,6 +9,14 @@ namespace Avalonia.Controls /// public class ProgressBar : RangeBase { + private Geometry _clipRect; + private double _Container2Width; + private double _ContainerWidth; + private double _containerAnimationStartPosition; + private double _containerAnimationEndPosition; + private double _container2AnimationStartPosition; + private double _container2AnimationEndPosition; + public static readonly StyledProperty IsIndeterminateProperty = AvaloniaProperty.Register(nameof(IsIndeterminate)); @@ -50,7 +55,7 @@ namespace Avalonia.Controls nameof(Container2Width), p => p.Container2Width, (p, o) => p.Container2Width = o); - + public static readonly DirectProperty ContainerWidthProperty = AvaloniaProperty.RegisterDirect( nameof(ContainerWidth), @@ -94,52 +99,42 @@ namespace Avalonia.Controls set => SetValue(OrientationProperty, value); } - private double _containerAnimationStartPosition; public double ContainerAnimationStartPosition { get => _containerAnimationStartPosition; set => SetAndRaise(ContainerAnimationStartPositionProperty, ref _containerAnimationStartPosition, value); } - private double _containerAnimationEndPosition; public double ContainerAnimationEndPosition { get => _containerAnimationEndPosition; set => SetAndRaise(ContainerAnimationEndPositionProperty, ref _containerAnimationEndPosition, value); } - private double _container2AnimationStartPosition; public double Container2AnimationStartPosition { get => _container2AnimationStartPosition; set => SetAndRaise(Container2AnimationStartPositionProperty, ref _container2AnimationStartPosition, value); } - - - - private double _Container2Width; public double Container2Width { get => _Container2Width; set => SetAndRaise(Container2WidthProperty, ref _Container2Width, value); } - private double _ContainerWidth; public double ContainerWidth { get => _ContainerWidth; set => SetAndRaise(ContainerWidthProperty, ref _ContainerWidth, value); } - private double _container2AnimationEndPosition; public double Container2AnimationEndPosition { get => _container2AnimationEndPosition; set => SetAndRaise(Container2AnimationEndPositionProperty, ref _container2AnimationEndPosition, value); } - - private Geometry _clipRect; + public Geometry ClipRect { get => _clipRect; @@ -192,7 +187,7 @@ namespace Avalonia.Controls ContainerAnimationStartPosition = barIndicatorWidth * -1.8; // Position at -180% ContainerAnimationEndPosition = barIndicatorWidth * 3.0; // Position at 300% - + Container2AnimationStartPosition = barIndicatorWidth2 * -1.5; // Position at -150% Container2AnimationEndPosition = barIndicatorWidth2 * 1.66; // Position at 166% From ea8609d5bd2f36483433a41dd77bda2f4c948369 Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Wed, 17 Jun 2020 18:52:12 -0300 Subject: [PATCH 10/17] take advantage of border clipping. --- src/Avalonia.Themes.Fluent/ProgressBar.xaml | 28 ++++++++++----------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/Avalonia.Themes.Fluent/ProgressBar.xaml b/src/Avalonia.Themes.Fluent/ProgressBar.xaml index cd801f9261..e60029a89a 100644 --- a/src/Avalonia.Themes.Fluent/ProgressBar.xaml +++ b/src/Avalonia.Themes.Fluent/ProgressBar.xaml @@ -2,7 +2,7 @@ - + @@ -17,15 +17,15 @@ - - + + - + - - + + @@ -83,7 +83,7 @@ - - - - - - - - From 72fb2dd4b57915dedfd9f2c2e6806416141ab756 Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Wed, 17 Jun 2020 19:11:12 -0300 Subject: [PATCH 13/17] use panel instead of grid. --- src/Avalonia.Themes.Fluent/ProgressBar.xaml | 28 ++++++++++----------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/src/Avalonia.Themes.Fluent/ProgressBar.xaml b/src/Avalonia.Themes.Fluent/ProgressBar.xaml index 6e2b4138b3..77a1dc0e25 100644 --- a/src/Avalonia.Themes.Fluent/ProgressBar.xaml +++ b/src/Avalonia.Themes.Fluent/ProgressBar.xaml @@ -17,18 +17,16 @@ - - - - + + + - - + + - - - + + @@ -57,30 +55,30 @@ - - - - - -