Reputation: 14677
In the properties for the parent window I set WindowStatupLocation=CenterScreen In the properties for the Child window I set WindowStatupLocation=CenterOwner
on the button click in the parent window if i show child window, the child window position is not center owner.
Is this is a bug in WPF or I am doing something wrong?
Upvotes: 1
Views: 1533
Reputation: 13408
Have you tried to explicitly set the ChildWindow.Parent property with the window that will be its parent ?
Upvotes: 0
Reputation: 9687
You have to set the owner of the child window to the parent window.
WindowChild windowChild = new WindowChild();
windowChild.WindowStartupLocation = WindowStartupLocation.CenterOwner; // you can set this in xaml
windowChild.Owner = this; // this is parent window
windowChild.Show();
Upvotes: 2