How to set Dialog's position that came from .ShowDialog();
to show at the center of the mainWindows.
This is the way I try to set position.
private void Window_Loaded(object sender, RoutedEventArgs e)
{
PresentationSource source = PresentationSource.FromVisual(this);
if (source != null)
{
Left = ??
Top = ??
}
}
In the XAML belonging to the Dialog:
<Window ... WindowStartupLocation="CenterOwner">
and in C# when you instantiate the Dialog:
MyDlg dlg = new MyDlg();
dlg.Owner = this;
if (dlg.ShowDialog() == true)
{
...