title: WPF Window set custom startup location/position within main screen
body: <p>I have a custom messagebox done in wpf.</p>
  
  <p><strong>Custom messagebox view xaml</strong>:</p>
  
  <pre><code>&lt;Window x:Class="My.XAML.Controls.Windows.WpfMessageBox"
          xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
          xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
          Title="WpfMessageBox"  MinHeight="160" 
          MinWidth="420" MaxHeight="750" MaxWidth="750" 
          Background="Transparent" 
          SizeToContent="WidthAndHeight" 
          WindowStartupLocation="CenterScreen"
          ShowInTaskbar="False" ResizeMode="NoResize" 
          WindowStyle="None" Topmost="True"&gt;
  
  &lt;/Window&gt;
  </code></pre>
  
  <p>From my main window I show this custom wpf messagebox window when user clicks on a button, as an example of the call from the button when it is clicked:</p>
  
  <pre><code>var messageBoxResult = WpfMessageBox.Show("Title", "MyMessage",
      MessageBoxButton.YesNo, WpfMessageBox.MessageBoxImage.Warning);
  
  if (messageBoxResult != MessageBoxResult.Yes) return;
  </code></pre>
  
  <p>*Custom messagebox code-behind xaml.cs:</p>
  
  <pre><code>public partial class WpfMessageBox : Window
  {
      private WpfMessageBox()
      {
          InitializeComponent();
      }
  
      public static MessageBoxResult Show(string caption, string text, MessageBoxButton button, MessageBoxImage image, EnumLocation location)
      {
            switch (location)
            {
                 case EnumLocation.TopLeft:
                       // Locates at top left
                       break;
                 case EnumLocation.TopCenter:
                       // Locates at top center
                       break;
                 case EnumLocation.TopRight:
                       // Locates at top right
                       break;
  
                 // and so on with the rest of cases: middle left, middle center, middle right, bottom left, bottom center and bottom right.
  
            }
      }
  }
  </code></pre>
  
  <p>By default this custom messagebox is opened at center of main screen. </p>
  
  <p>What I would like to do now is to pass a parameter (enumeration) to my WpfMessageBox.Show method to indicate to my custom message box where I want it to be located within the main screen. Parameters would be these:</p>
  
  <ul>
  <li>Top Left</li>
  <li>Top Center</li>
  <li>Top Right</li>
  <li>Middle Left</li>
  <li>Middle Center</li>
  <li>Middle Right</li>
  <li>Botton Left</li>
  <li>Bottom Center</li>
  <li>Bottom Right</li>
  </ul>
  
  <p>How can I do this?</p>