-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathViewController.cs
53 lines (44 loc) · 1.47 KB
/
ViewController.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
48
49
50
51
52
53
using Avalonia.Controls;
using ObjCRuntime;
namespace Xamarin.Mac.Interop
{
public partial class ViewController : NSViewController
{
protected ViewController(NativeHandle handle) : base(handle)
{
// This constructor is required if the view controller is loaded from a xib or a storyboard.
// Do not put any initialization here, use ViewDidLoad instead.
}
private AvaloniaView _embeddedView = new AvaloniaView();
public override void ViewDidLoad()
{
base.ViewDidLoad();
// Do any additional setup after loading the view.
if (_embeddedView.AvnView != null)
{
View.AddSubview(_embeddedView.AvnView);
_embeddedView.Start();
var panel = new StackPanel
{
Children =
{
new TextBlock { Text = "Avalonia TextBlock" },
new TextBox { Text = "Avalonia TextBox" }
},
Width = 200,
Height = 100
};
_embeddedView.Content = panel;
}
}
public override NSObject RepresentedObject
{
get => base.RepresentedObject;
set
{
base.RepresentedObject = value;
// Update the view, if already loaded.
}
}
}
}