title: How to center MDI child Form?
body: <p>I have this code, to add a new child:</p>
  
  <pre><code>  private void Menu1_Click(object sender, RoutedEventArgs e)
      {
  
          Point centerPoint = new Point((Container.ActualWidth  / 2) - (500/2), (Container.ActualHeight / 2) - (400 / 2));
  
  
          MdiChild newForm = new MdiChild();
          newForm.Title = "My Form";
          newForm.Content = new MyForm1();
          newForm.Width = 500;
          newForm.Height = 400;
          newForm.Resizable = false;
          newForm.MaximizeBox = false;
          newForm.Position = centerPoint;
  
          Container.Children.Add(newForm);
      }
  </code></pre>
  
  <p>This code is for the view:</p>
  
  <pre><code>&lt;Window x:Class="WpfApplication1.MainWindow"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
      xmlns:local="clr-namespace:WpfApplication1"
      mc:Ignorable="d"
       xmlns:mdi="clr-namespace:WPF.MDI;assembly=WPF.MDI"
  Title="WPF.MDI Example" Height="362" Width="684" WindowState="Maximized"&gt;
  &lt;DockPanel&gt;
      &lt;mdi:MdiContainer Name="Container" Background="#FF474040" &gt;
          &lt;mdi:MdiContainer.Menu&gt;
              &lt;Menu DockPanel.Dock="Top" Width="677"&gt;                  
                  &lt;MenuItem Header="Menu1" click="Menu1_Click"&gt;                        
          &lt;/mdi:MdiContainer.Menu&gt;
      &lt;/mdi:MdiContainer&gt;
  &lt;/DockPanel&gt;
  </code></pre>
  
  <p></p>
  
  <p>How can I center MDI child Form? </p>
  
  <p>It always opens in the upper left side</p>
  
  <p>I don't find the solution yet, </p>
  
  <p>Thanks.                                </p>
  
  <p>I also tried to put this code, in the code behind form child, but it doesn't works:</p>
  
  <pre><code>    public partial class MyForm1: UserControl
  {
      BalanceEntities db = new BalanceEntities();
      public MyForm1()
      {
          InitializeComponent();
          this.HorizontalAlignment = HorizontalAlignment.Center;
          this.VerticalAlignment = VerticalAlignment.Center;
  
      }       
  }
  </code></pre>