Browse Source
* feature: Support Inlines, sync XamlX, use Avalonia 11 * chore: Bump version * chore: Update docspull/10407/head 1.6.1
committed by
GitHub
38 changed files with 147 additions and 136 deletions
@ -1 +1 @@ |
|||||
Subproject commit 5420df861ce6f2be5ead9efa078fe7242ce88f18 |
Subproject commit 5e498f8bcca403a34aff5efc825cbb4e12b7fa8e |
||||
@ -1,33 +1,25 @@ |
|||||
using System.Linq; |
using System.Linq; |
||||
using XamlX.TypeSystem; |
using XamlX.TypeSystem; |
||||
|
|
||||
namespace Avalonia.NameGenerator.Generator; |
namespace Avalonia.NameGenerator.Generator; |
||||
|
|
||||
internal static class ResolverExtensions |
internal static class ResolverExtensions |
||||
{ |
{ |
||||
public static bool IsAvaloniaControl(this IXamlType clrType) |
public static bool IsAvaloniaStyledElement(this IXamlType clrType) => |
||||
{ |
clrType.HasStyledElementBaseType() || |
||||
return clrType.HasControlBaseType() || clrType.HasIControlInterface(); |
clrType.HasIStyledElementInterface(); |
||||
} |
|
||||
|
private static bool HasStyledElementBaseType(this IXamlType clrType) |
||||
private static bool HasControlBaseType(this IXamlType clrType) |
{ |
||||
{ |
// Check for the base type since IStyledElement interface is removed.
|
||||
// Check for the base type since IControl interface is removed.
|
// https://github.com/AvaloniaUI/Avalonia/pull/9553
|
||||
// https://github.com/AvaloniaUI/Avalonia/pull/9553
|
if (clrType.FullName == "Avalonia.StyledElement") |
||||
if (clrType.FullName == "Avalonia.Controls.Control") |
return true; |
||||
return true; |
return clrType.BaseType != null && IsAvaloniaStyledElement(clrType.BaseType); |
||||
|
} |
||||
if (clrType.BaseType != null) |
|
||||
return IsAvaloniaControl(clrType.BaseType); |
private static bool HasIStyledElementInterface(this IXamlType clrType) => |
||||
|
clrType.Interfaces.Any(abstraction => |
||||
return false; |
abstraction.IsInterface && |
||||
} |
abstraction.FullName == "Avalonia.IStyledElement"); |
||||
|
|
||||
private static bool HasIControlInterface(this IXamlType clrType) |
|
||||
{ |
|
||||
return clrType |
|
||||
.Interfaces |
|
||||
.Any(abstraction => abstraction.IsInterface && |
|
||||
abstraction.FullName == "Avalonia.Controls.IControl"); |
|
||||
} |
|
||||
} |
} |
||||
Loading…
Reference in new issue