-
Notifications
You must be signed in to change notification settings - Fork 1.7k
/
_11132CustomRenderer.cs
47 lines (40 loc) · 1.42 KB
/
_11132CustomRenderer.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
using System.Diagnostics;
using CoreAnimation;
using CoreGraphics;
using Xamarin.Forms;
using Xamarin.Forms.ControlGallery.iOS;
using Xamarin.Forms.Controls.Issues;
using Xamarin.Forms.Platform.iOS;
[assembly: ExportRenderer(typeof(Issue11132Control), typeof(_11132CustomRenderer))]
namespace Xamarin.Forms.ControlGallery.iOS
{
public class _11132CustomRenderer : VisualElementRenderer<Issue11132Control>
{
protected override void OnElementChanged(ElementChangedEventArgs<Issue11132Control> e)
{
base.OnElementChanged(e);
var layer = Layer;
if (layer != null)
{
layer.BorderWidth = 10;
layer.BorderColor = Color.Red.ToCGColor();
layer.BackgroundColor = Color.Orange.ToCGColor();
var width = 100;
var height = 25;
var clipPath = new CGPath();
clipPath.MoveToPoint(width, height);
clipPath.AddLineToPoint(width * 2, height);
clipPath.AddLineToPoint(width * 2, height * 2);
clipPath.AddLineToPoint(width, height * 2);
clipPath.CloseSubpath();
var clipShapeLayer = new CAShapeLayer
{
Path = clipPath
};
layer.Mask = clipShapeLayer;
layer.Mask.Name = "test";
Debug.WriteLine($"_11132CustomRenderer Layer Name { layer.Mask.Name}");
}
}
}
}