diff --git a/samples/IntegrationTestApp/IntegrationTestApp.csproj b/samples/IntegrationTestApp/IntegrationTestApp.csproj
index e1bfd6e7b1..7f8c45533a 100644
--- a/samples/IntegrationTestApp/IntegrationTestApp.csproj
+++ b/samples/IntegrationTestApp/IntegrationTestApp.csproj
@@ -4,6 +4,7 @@
$(AvsCurrentTargetFramework)
enable
$(NoWarn);AVP1012
+ true
@@ -37,5 +38,6 @@
+
diff --git a/samples/IntegrationTestApp/MainWindow.axaml b/samples/IntegrationTestApp/MainWindow.axaml
index 64c94ad9fa..c70d6b7ca0 100644
--- a/samples/IntegrationTestApp/MainWindow.axaml
+++ b/samples/IntegrationTestApp/MainWindow.axaml
@@ -5,7 +5,6 @@
xmlns:integrationTestApp="using:IntegrationTestApp"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="IntegrationTestApp.MainWindow"
- Name="MainWindow"
Icon="/Assets/icon.ico"
Title="IntegrationTestApp"
x:DataType="integrationTestApp:MainWindow">
@@ -24,7 +23,7 @@
-
+
WindowState:
@@ -178,7 +177,20 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/samples/IntegrationTestApp/MainWindow.axaml.cs b/samples/IntegrationTestApp/MainWindow.axaml.cs
index 4f033ea346..0c94857a03 100644
--- a/samples/IntegrationTestApp/MainWindow.axaml.cs
+++ b/samples/IntegrationTestApp/MainWindow.axaml.cs
@@ -8,24 +8,25 @@ using Avalonia.Controls.Primitives;
using Avalonia.Controls.Primitives.PopupPositioning;
using Avalonia.Input;
using Avalonia.Interactivity;
-using Avalonia.Markup.Xaml;
using Avalonia.Media;
+using Avalonia.Platform;
using Avalonia.VisualTree;
-using Microsoft.CodeAnalysis;
namespace IntegrationTestApp
{
- public class MainWindow : Window
+ public partial class MainWindow : Window
{
public MainWindow()
{
+ // Set name in code behind, so source generator will ignore it.
+ Name = "MainWindow";
+
InitializeComponent();
InitializeViewMenu();
InitializeGesturesTab();
this.AttachDevTools();
- var overlayPopups = this.Get("AppOverlayPopups");
- overlayPopups.Text = Program.OverlayPopups ? "Overlay Popups" : "Native Popups";
+ AppOverlayPopups.Text = Program.OverlayPopups ? "Overlay Popups" : "Native Popups";
AddHandler(Button.ClickEvent, OnButtonClick);
ListBoxItems = Enumerable.Range(0, 100).Select(x => "Item " + x).ToList();
@@ -34,17 +35,11 @@ namespace IntegrationTestApp
public List ListBoxItems { get; }
- private void InitializeComponent()
- {
- AvaloniaXamlLoader.Load(this);
- }
-
private void InitializeViewMenu()
{
- var mainTabs = this.Get("MainTabs");
var viewMenu = (NativeMenuItem?)NativeMenu.GetMenu(this)?.Items[1];
- foreach (var tabItem in mainTabs.Items.Cast())
+ foreach (var tabItem in MainTabs.Items.Cast())
{
var menuItem = new NativeMenuItem
{
@@ -59,16 +54,16 @@ namespace IntegrationTestApp
}
}
- private void ShowWindow()
+ private void OnShowWindow()
{
- var sizeTextBox = this.GetControl("ShowWindowSize");
- var modeComboBox = this.GetControl("ShowWindowMode");
- var locationComboBox = this.GetControl("ShowWindowLocation");
- var stateComboBox = this.GetControl("ShowWindowState");
+ var sizeTextBox = ShowWindowSize;
+ var modeComboBox = ShowWindowMode;
+ var locationComboBox = ShowWindowLocation;
+ var stateComboBox = ShowWindowState;
var size = !string.IsNullOrWhiteSpace(sizeTextBox.Text) ? Size.Parse(sizeTextBox.Text) : (Size?)null;
- var systemDecorations = this.GetControl("ShowWindowSystemDecorations");
- var extendClientArea = this.GetControl("ShowWindowExtendClientAreaToDecorationsHint");
- var canResizeCheckBox = this.GetControl("ShowWindowCanResize");
+ var systemDecorations = ShowWindowSystemDecorations;
+ var extendClientArea = ShowWindowExtendClientAreaToDecorationsHint;
+ var canResizeCheckBox = ShowWindowCanResize;
var owner = (Window)this.GetVisualRoot()!;
var window = new ShowWindowTest
@@ -113,7 +108,7 @@ namespace IntegrationTestApp
}
}
- private void ShowTransparentWindow()
+ private void OnShowTransparentWindow()
{
// Show a background window to make sure the color behind the transparent window is
// a known color (green).
@@ -155,7 +150,7 @@ namespace IntegrationTestApp
window.Show(backgroundWindow);
}
- private void ShowTransparentPopup()
+ private void OnShowTransparentPopup()
{
var popup = new Popup
{
@@ -196,7 +191,7 @@ namespace IntegrationTestApp
popup.Open();
}
- private void SendToBack()
+ private void OnSendToBack()
{
var lifetime = (ClassicDesktopStyleApplicationLifetime)Application.Current!.ApplicationLifetime!;
@@ -206,7 +201,7 @@ namespace IntegrationTestApp
}
}
- private void RestoreAll()
+ private void OnRestoreAll()
{
var lifetime = (ClassicDesktopStyleApplicationLifetime)Application.Current!.ApplicationLifetime!;
@@ -218,7 +213,7 @@ namespace IntegrationTestApp
}
}
- private void ShowTopmostWindow()
+ private void OnShowTopmostWindow()
{
var mainWindow = new TopmostWindowTest("OwnerWindow") { Topmost = true, Title = "Owner Window"};
var ownedWindow = new TopmostWindowTest("OwnedWindow") { WindowStartupLocation = WindowStartupLocation.CenterOwner, Title = "Owned Window"};
@@ -229,10 +224,10 @@ namespace IntegrationTestApp
private void InitializeGesturesTab()
{
- var gestureBorder = this.GetControl("GestureBorder");
- var gestureBorder2 = this.GetControl("GestureBorder2");
- var lastGesture = this.GetControl("LastGesture");
- var resetGestures = this.GetControl