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

38 строки
1014 B
C#

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)]
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)
{
SetNativeControl(new MaterialCanvas(System.Maui.Maui.NativeParent));
}
base.OnElementChanged(e);
}
void UpdateBorderColor()
{
Control.BorderColor = Element.BorderColor.ToNative();
}
void UpdateShadowVisibility()
{
Control.HasShadow = Element.HasShadow;
}
}
}