Open PepiBobanov opened 2 years ago
It become Help yourself thing :) window.SizeChanged += (s, e) => CenterOwner(window);
private void CenterOwner( Window w)
{
if (w.Owner != null)
{
double top = w.Owner.Top + ((w.Owner.Height - w.ActualHeight) / 2);
double left = w.Owner.Left + ((w.Owner.Width - w.ActualWidth) / 2);
w.Top = top < 0 ? 0 : top;
w.Left = left < 0 ? 0 : left;
}
}
Create new AdonisWindow with SizeToContent="WidthAndHeight" and WindowStartupLocation="CenterOwner"
Owner = parent ShowDialog()
window is not centered :(