blob: 2f723f3e9f5ea5a79c2b1ccdcc8bef42f7ee2faf (
plain)
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
48
49
50
51
52
53
54
|
using System;
namespace Xamarin.Forms.Platform.Tizen
{
/// <summary>
/// Renderer of a Layout.
/// </summary>
public class LayoutRenderer : ViewRenderer<Layout, Native.Canvas>
{
bool _isLayoutUpdatedRegistered = false;
/// <summary>
/// Default constructor.
/// </summary>
public LayoutRenderer()
{
}
public void RegisterOnLayoutUpdated()
{
if (!_isLayoutUpdatedRegistered)
{
Control.LayoutUpdated += OnLayoutUpdated;
_isLayoutUpdatedRegistered = true;
}
}
protected override void OnElementChanged(ElementChangedEventArgs<Layout> e)
{
if (null == Control)
{
var canvas = new Native.Canvas(Forms.Context.MainWindow);
SetNativeControl(canvas);
}
base.OnElementChanged(e);
}
protected override void Dispose(bool disposing)
{
if (_isLayoutUpdatedRegistered)
{
Control.LayoutUpdated -= OnLayoutUpdated;
}
base.Dispose(disposing);
}
void OnLayoutUpdated(object sender, Native.LayoutEventArgs e)
{
DoLayout(e);
}
}
}
|