Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
rmbadmin committed May 5, 2021
1 parent cc5b161 commit 6581d67
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,11 @@ private void FluentWindow_Opened(object? sender, EventArgs e)
if (this.DataContext is WindowViewModel vm)
{
if (vm.SizePosition.X > 0 && vm.SizePosition.Y > 0)
this.Position = new PixelPoint(vm.SizePosition.X, vm.SizePosition.Y);
{
var point = new PixelPoint(vm.SizePosition.X, vm.SizePosition.Y);
if (Screens.Primary.WorkingArea.Contains(point))
this.Position = point;
}

if (vm.SizePosition.Width > 0)
this.Width = vm.SizePosition.Width;
Expand All @@ -54,6 +58,7 @@ private void FluentWindow_Opened(object? sender, EventArgs e)
this.Height = vm.SizePosition.Height;

HandleResized(new Size(this.Width, this.Height));

this.GetObservable(WidthProperty).Subscribe(v =>
{
vm.SizePosition.Width = v;
Expand Down

0 comments on commit 6581d67

Please sign in to comment.