using System; using Avalonia.Controls; using Avalonia.Interactivity; using Avalonia.Markup.Xaml; using Avalonia.Rendering; namespace IntegrationTestApp { public class ShowWindowTest : Window { public ShowWindowTest() { InitializeComponent(); } private void InitializeComponent() { AvaloniaXamlLoader.Load(this); } protected override void OnOpened(EventArgs e) { base.OnOpened(e); this.GetControl("ClientSize").Text = $"{Width}, {Height}"; this.GetControl("FrameSize").Text = $"{FrameSize}"; this.GetControl("Position").Text = $"{Position}"; this.GetControl("ScreenRect").Text = $"{Screens.ScreenFromVisual(this)?.WorkingArea}"; this.GetControl("Scaling").Text = $"{((IRenderRoot)this).RenderScaling}"; // TODO Use DesktopScaling from WindowImpl. if (Owner is not null) { var ownerRect = this.GetControl("OwnerRect"); var owner = (Window)Owner; ownerRect.Text = $"{owner.Position}, {owner.FrameSize}"; } } private void CloseWindow_Click(object sender, RoutedEventArgs e) => Close(); } }