-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMainWindow.xaml.cs
37 lines (33 loc) · 958 Bytes
/
MainWindow.xaml.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
using System;
using Avalonia;
using Avalonia.Controls;
using Avalonia.Markup.Xaml;
namespace AvaloniaFindControl
{
public class MainWindow : Window
{
private readonly SampleUserControl sampleUserControl;
private readonly TextBlock textBlock;
public MainWindow()
{
InitializeComponent();
#if DEBUG
this.AttachDevTools();
#endif
this.textBlock = this.FindControl<TextBlock>("textBlock");
this.sampleUserControl = this.FindControl<SampleUserControl>("sampleUserControl");
if (textBlock == null)
{
throw new Exception("Textblock was not found");
}
if (sampleUserControl == null)
{
throw new Exception("SampleUserControl was not found");
}
}
private void InitializeComponent()
{
AvaloniaXamlLoader.Load(this);
}
}
}