Skip to content

Commit

Permalink
chore: Fixing windows build
Browse files Browse the repository at this point in the history
  • Loading branch information
nickrandolph committed Jan 19, 2024
1 parent 86d4c6f commit 7e70837
Showing 1 changed file with 26 additions and 3 deletions.
29 changes: 26 additions & 3 deletions src/Uno.Toolkit.UI/Behaviors/ProgressExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
using Uno.Logging;
using System.Diagnostics.CodeAnalysis;
using Uno.UI.Extensions;
using Windows.UI.Xaml.Media;



#if IS_WINUI
Expand Down Expand Up @@ -39,14 +41,14 @@ private static void IsActiveChanged(DependencyObject d, DependencyPropertyChange
{
if (d is FrameworkElement element &&
e.NewValue is bool isActive)
{
{
foreach (var item in element.EnumerateDescendants())
{
if(item is ProgressRing progressRing)
if (item is ProgressRing progressRing)
{
progressRing.IsActive = isActive;
}
else if(item is ProgressBar progressBar)
else if (item is ProgressBar progressBar)
{
progressBar.IsIndeterminate = isActive;
}
Expand All @@ -63,5 +65,26 @@ public static bool GetIsActive(this FrameworkElement element)
{
return (bool)element.GetValue(IsActiveProperty);
}

#if WINDOWS_UWP || WINDOWS
// Copied from Uno.UI.Extensions.ViewExtensions for Windows targets
private static IEnumerable<DependencyObject> EnumerateDescendants(this DependencyObject reference)
{
foreach (DependencyObject child in reference.EnumerateChildren())
{
yield return child;
foreach (DependencyObject item in child.EnumerateDescendants())
{
yield return item;
}
}
}

private static IEnumerable<DependencyObject> EnumerateChildren(this DependencyObject reference)
{
return from x in Enumerable.Range(0, VisualTreeHelper.GetChildrenCount(reference))
select VisualTreeHelper.GetChild(reference, x);
}
}
#endif
}

Check failure on line 90 in src/Uno.Toolkit.UI/Behaviors/ProgressExtensions.cs

View workflow job for this annotation

GitHub Actions / Build and Deploy Job

} expected

Check failure on line 90 in src/Uno.Toolkit.UI/Behaviors/ProgressExtensions.cs

View workflow job for this annotation

GitHub Actions / Build and Deploy Job

} expected

0 comments on commit 7e70837

Please sign in to comment.