blob: 69fd24a8ca08dc55a706311166c4ef24f27752ec (
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
55
56
57
58
59
60
61
62
|
using System;
namespace Xamarin.Forms.Platform.Tizen
{
/// <summary>
/// Renderer of a Layout.
/// </summary>
public class LayoutRenderer : ViewRenderer<Layout, Native.Canvas>
{
bool _layoutUpdatedRegistered = false;
public void RegisterOnLayoutUpdated()
{
if (!_layoutUpdatedRegistered)
{
Control.LayoutUpdated += OnLayoutUpdated;
_layoutUpdatedRegistered = true;
}
}
protected override void OnElementChanged(ElementChangedEventArgs<Layout> e)
{
if (null == Control)
{
SetNativeControl(new Native.Canvas(Forms.Context.MainWindow));
}
base.OnElementChanged(e);
}
protected override void Dispose(bool disposing)
{
if (disposing)
{
if (_layoutUpdatedRegistered)
{
Control.LayoutUpdated -= OnLayoutUpdated;
_layoutUpdatedRegistered = false;
}
}
base.Dispose(disposing);
}
protected override void UpdateLayout()
{
base.UpdateLayout();
if (!_layoutUpdatedRegistered)
{
foreach (var child in Element.LogicalChildren)
{
Platform.GetRenderer(child)?.UpdateNativeGeometry();
}
}
}
void OnLayoutUpdated(object sender, Native.LayoutEventArgs e)
{
DoLayout(e);
}
}
}
|