From b59f084ab2124ac9b448e0c030cd6b87c0459a59 Mon Sep 17 00:00:00 2001 From: Nick Randolph Date: Wed, 17 Jan 2024 02:17:38 +1100 Subject: [PATCH 1/7] feat: Adding ProgressRing extension --- .../Uno.Toolkit.Samples.Shared/App.xaml | 1 - .../Content/Controls/LoadingViewSample.xaml | 2 +- .../Behaviors/ProgressRingExtensions.cs | 60 +++++++++++++++++++ .../ExtendedSplashScreen.xaml | 11 +++- .../Controls/LoadingView/LoadingView.xaml | 9 ++- 5 files changed, 79 insertions(+), 4 deletions(-) create mode 100644 src/Uno.Toolkit.UI/Behaviors/ProgressRingExtensions.cs diff --git a/samples/Uno.Toolkit.Samples/Uno.Toolkit.Samples.Shared/App.xaml b/samples/Uno.Toolkit.Samples/Uno.Toolkit.Samples.Shared/App.xaml index 0dfb44b00..e05e3d1fa 100644 --- a/samples/Uno.Toolkit.Samples/Uno.Toolkit.Samples.Shared/App.xaml +++ b/samples/Uno.Toolkit.Samples/Uno.Toolkit.Samples.Shared/App.xaml @@ -53,7 +53,6 @@ - + diff --git a/src/Uno.Toolkit.UI/Behaviors/ProgressRingExtensions.cs b/src/Uno.Toolkit.UI/Behaviors/ProgressRingExtensions.cs new file mode 100644 index 000000000..84a46583f --- /dev/null +++ b/src/Uno.Toolkit.UI/Behaviors/ProgressRingExtensions.cs @@ -0,0 +1,60 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Input; +using Windows.System; +using Microsoft.Extensions.Logging; +using Uno.Extensions; +using Uno.Logging; +using System.Diagnostics.CodeAnalysis; +using Uno.UI.Extensions; + + +#if IS_WINUI +using Microsoft.UI.Xaml; +using Microsoft.UI.Xaml.Controls; +using Microsoft.UI.Xaml.Input; +#else +using Windows.UI.Xaml; +using Windows.UI.Xaml.Controls; +using Windows.UI.Xaml.Input; +using ItemsRepeater = Microsoft.UI.Xaml.Controls.ItemsRepeater; +#endif + + +namespace Uno.Toolkit.UI +{ + public static class ProgressRingExtensions + { + public static readonly DependencyProperty IsActiveProperty = + DependencyProperty.RegisterAttached( + "IsActive", + typeof(bool), + typeof(ProgressRingExtensions), + new PropertyMetadata(false, IsActiveChanged)); + + private static void IsActiveChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) + { + if (d is FrameworkElement element && + e.NewValue is bool isActive) + { + foreach (var item in element.EnumerateDescendants().OfType()) + { + item.IsActive = isActive; + } + } + } + + public static void SetIsActive(this FrameworkElement element, bool value) + { + element.SetValue(IsActiveProperty, value); + } + + public static bool GetIsActive(this FrameworkElement element) + { + return (bool)element.GetValue(IsActiveProperty); + } + } +} diff --git a/src/Uno.Toolkit.UI/Controls/ExtendedSplashScreen/ExtendedSplashScreen.xaml b/src/Uno.Toolkit.UI/Controls/ExtendedSplashScreen/ExtendedSplashScreen.xaml index f2eaa5c46..567407c31 100644 --- a/src/Uno.Toolkit.UI/Controls/ExtendedSplashScreen/ExtendedSplashScreen.xaml +++ b/src/Uno.Toolkit.UI/Controls/ExtendedSplashScreen/ExtendedSplashScreen.xaml @@ -57,7 +57,12 @@ - + + + + + + + + @@ -84,6 +91,7 @@ VerticalContentAlignment="Stretch" /> - + + + + + + @@ -62,12 +67,14 @@ Date: Sat, 20 Jan 2024 02:17:25 +1100 Subject: [PATCH 2/7] chore: Renaming ProgressRingExtensions to ProgressExtensions and include ProgressBar --- .../Content/Controls/LoadingViewSample.xaml | 106 +++++++++--------- ...ingExtensions.cs => ProgressExtensions.cs} | 15 ++- .../ExtendedSplashScreen.xaml | 12 +- .../Controls/LoadingView/LoadingView.xaml | 8 +- 4 files changed, 74 insertions(+), 67 deletions(-) rename src/Uno.Toolkit.UI/Behaviors/{ProgressRingExtensions.cs => ProgressExtensions.cs} (79%) diff --git a/samples/Uno.Toolkit.Samples/Uno.Toolkit.Samples.Shared/Content/Controls/LoadingViewSample.xaml b/samples/Uno.Toolkit.Samples/Uno.Toolkit.Samples.Shared/Content/Controls/LoadingViewSample.xaml index 3f38a5c95..308bfd824 100644 --- a/samples/Uno.Toolkit.Samples/Uno.Toolkit.Samples.Shared/Content/Controls/LoadingViewSample.xaml +++ b/samples/Uno.Toolkit.Samples/Uno.Toolkit.Samples.Shared/Content/Controls/LoadingViewSample.xaml @@ -1,60 +1,60 @@ - + - - - - - - - - - - - + + + + + + + + + + + - - - + + + -