From 519e850bf838a42dbc8243c37ecf0348175424ed Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Mon, 27 Jun 2022 12:49:08 +0200 Subject: [PATCH] Correctly update position. `Window.Position` isn't an Avalonia property so doesn't auto-update, we need to listen for `PositionChanged`. --- samples/IntegrationTestApp/ShowWindowTest.axaml | 3 +-- samples/IntegrationTestApp/ShowWindowTest.axaml.cs | 2 ++ 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/samples/IntegrationTestApp/ShowWindowTest.axaml b/samples/IntegrationTestApp/ShowWindowTest.axaml index a861130cd0..40c1642e91 100644 --- a/samples/IntegrationTestApp/ShowWindowTest.axaml +++ b/samples/IntegrationTestApp/ShowWindowTest.axaml @@ -13,8 +13,7 @@ Text="{Binding FrameSize, Mode=OneWay}"/> - + diff --git a/samples/IntegrationTestApp/ShowWindowTest.axaml.cs b/samples/IntegrationTestApp/ShowWindowTest.axaml.cs index 69b6d64557..42df0b704f 100644 --- a/samples/IntegrationTestApp/ShowWindowTest.axaml.cs +++ b/samples/IntegrationTestApp/ShowWindowTest.axaml.cs @@ -12,6 +12,7 @@ namespace IntegrationTestApp { InitializeComponent(); DataContext = this; + PositionChanged += (s, e) => this.GetControl("Position").Text = $"{Position}"; } private void InitializeComponent() @@ -22,6 +23,7 @@ namespace IntegrationTestApp protected override void OnOpened(EventArgs e) { base.OnOpened(e); + this.GetControl("Position").Text = $"{Position}"; this.GetControl("ScreenRect").Text = $"{Screens.ScreenFromVisual(this)?.WorkingArea}"; this.GetControl("Scaling").Text = $"{PlatformImpl?.DesktopScaling}";