A cross-platform UI framework for .NET
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

22 lines
599 B

using System.Collections.Generic;
using System.Linq;
using Avalonia.Styling;
namespace Avalonia.Themes.UnitTests.Utilities;
public static class StyleExtensions
{
public static IEnumerable<StyleBase> EnumerateStyles(this IStyle style)
{
if (style is StyleBase styleBase)
{
yield return styleBase;
}
// IStyle.Children enumerates both Style's nested styles and Styles (collection) children.
foreach (var nestedStyle in style.Children.SelectMany(s => s.EnumerateStyles()))
{
yield return nestedStyle;
}
}
}