maui-linux/System.Maui.Material.Tizen/MaterialFrameRenderer.cs

38 строки
1014 B
C#
Исходник Обычный вид История

2020-05-19 03:56:25 +03:00
using System.Maui;
using System.Maui.Platform.Tizen;
using System.Maui.Platform.Tizen.Native;
using System.Maui.Material.Tizen;
using Tizen.NET.MaterialComponents;
[assembly: ExportRenderer(typeof(Frame), typeof(MaterialFrameRenderer), new[] { typeof(VisualMarker.MaterialVisual) }, Priority = short.MinValue)]
2020-05-19 03:56:25 +03:00
namespace System.Maui.Material.Tizen
{
public class MaterialFrameRenderer : ViewRenderer<Frame, MCard>
{
public MaterialFrameRenderer()
{
RegisterPropertyHandler(Frame.BorderColorProperty, UpdateBorderColor);
RegisterPropertyHandler(Frame.HasShadowProperty, UpdateShadowVisibility);
}
protected override void OnElementChanged(ElementChangedEventArgs<Frame> e)
{
if (Control == null)
{
2020-05-19 03:56:25 +03:00
SetNativeControl(new MaterialCanvas(System.Maui.Maui.NativeParent));
}
base.OnElementChanged(e);
}
void UpdateBorderColor()
{
Control.BorderColor = Element.BorderColor.ToNative();
}
void UpdateShadowVisibility()
{
Control.HasShadow = Element.HasShadow;
}
}
}