Browse Source

Correctly update position.

`Window.Position` isn't an Avalonia property so doesn't auto-update, we need to listen for `PositionChanged`.
pull/8405/head
Steven Kirk 4 years ago
parent
commit
519e850bf8
  1. 3
      samples/IntegrationTestApp/ShowWindowTest.axaml
  2. 2
      samples/IntegrationTestApp/ShowWindowTest.axaml.cs

3
samples/IntegrationTestApp/ShowWindowTest.axaml

@ -13,8 +13,7 @@
Text="{Binding FrameSize, Mode=OneWay}"/>
<Label Grid.Column="0" Grid.Row="3">Position</Label>
<TextBox Name="Position" Grid.Column="1" Grid.Row="3" IsReadOnly="True"
Text="{Binding Position, Mode=OneWay}"/>
<TextBox Name="Position" Grid.Column="1" Grid.Row="3" IsReadOnly="True"/>
<Label Grid.Column="0" Grid.Row="4">Owner Rect</Label>
<TextBox Name="OwnerRect" Grid.Column="1" Grid.Row="4" IsReadOnly="True"/>

2
samples/IntegrationTestApp/ShowWindowTest.axaml.cs

@ -12,6 +12,7 @@ namespace IntegrationTestApp
{
InitializeComponent();
DataContext = this;
PositionChanged += (s, e) => this.GetControl<TextBox>("Position").Text = $"{Position}";
}
private void InitializeComponent()
@ -22,6 +23,7 @@ namespace IntegrationTestApp
protected override void OnOpened(EventArgs e)
{
base.OnOpened(e);
this.GetControl<TextBox>("Position").Text = $"{Position}";
this.GetControl<TextBox>("ScreenRect").Text = $"{Screens.ScreenFromVisual(this)?.WorkingArea}";
this.GetControl<TextBox>("Scaling").Text = $"{PlatformImpl?.DesktopScaling}";

Loading…
Cancel
Save