maui-linux/Xamarin.Forms.ControlGaller.../RegistrarValidationService.cs

31 строка
758 B
C#

using Xamarin.Forms;
using Xamarin.Forms.ControlGallery.WPF;
using Xamarin.Forms.Controls;
using Xamarin.Forms.Platform.WPF;
[assembly: Dependency(typeof(RegistrarValidationService))]
namespace Xamarin.Forms.ControlGallery.WPF
{
public class RegistrarValidationService : IRegistrarValidationService
{
public bool Validate(VisualElement element, out string message)
{
message = "Success";
if (element == null || element is OpenGLView)
return true;
var renderer = Platform.WPF.Platform.GetOrCreateRenderer(element);
if (renderer == null
|| renderer.GetType().Name == "DefaultRenderer"
)
{
message = $"Failed to load proper WPF renderer for {element.GetType().Name}";
return false;
}
return true;
}
}
}