punker76 / MahApps.Metro.SimpleChildWindow

A simple child window for MahApps.Metro
MIT License
374 stars 55 forks source link

ChildWindow moving issue #74

Closed BaranPiotr closed 5 years ago

BaranPiotr commented 6 years ago

When I set VerticalContentAlignment to Bottom and AllowMove to true i can move ChildWindow maximum to half of parent. I think this is issue witch calculate offsets and for testing this concept I change the calculate offset in ProcessMove method in clone repository from

var widthOffset = width / 2 - this.partWindow.RenderSize.Width / 2; var heightOffset = height / 2 - this.partWindow.RenderSize.Height / 2;

to

var offset = VisualTreeHelper.GetOffset(this.partWindow); var widthOffset = offset.X; var heightOffset = offset.Y;

After these changes issue with moving will disappear. I don't know if this is a the best way to fix this issue.

punker76 commented 5 years ago

@BaranPiotr Your suggestion have been merged, thanks for your contribution 👍