maui-linux/Xamarin.Forms.Platform.Android/VisualElementExtensions.cs

26 строки
818 B
C#

using System;
using Xamarin.Forms.PlatformConfiguration.AndroidSpecific;
namespace Xamarin.Forms.Platform.Android
{
public static class VisualElementExtensions
{
public static IVisualElementRenderer GetRenderer(this VisualElement self)
{
if (self == null)
throw new ArgumentNullException(nameof(self));
IVisualElementRenderer renderer = Platform.GetRenderer(self);
return renderer;
}
internal static bool UseLegacyColorManagement<T>(this T element) where T : VisualElement, IElementConfiguration<T>
{
// Determine whether we're letting the VSM handle the colors or doing it the old way
// or disabling the legacy color management and doing it the old-old (pre 2.0) way
return !element.HasVisualStateGroups()
&& element.OnThisPlatform().GetIsLegacyColorModeEnabled();
}
}
}