Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You can simply use the <a href="http://msdn.microsoft.com/en-us/library/system.windows.window.left.aspx" rel="noreferrer">Window.Left</a> and <a href="http://msdn.microsoft.com/en-us/library/system.windows.window.top.aspx" rel="noreferrer">Window.Top</a> properties. Read them from your main window and assign the values (plus 20 px or whatever) to the AboutBox <strong>before</strong> calling the <code>ShowDialog()</code> method.</p> <pre><code>AboutBox dialog = new AboutBox(); dialog.Top = mainWindow.Top + 20; </code></pre> <p>To have it centered, you can also simply use the <a href="http://msdn.microsoft.com/en-us/library/system.windows.window.windowstartuplocation.aspx" rel="noreferrer">WindowStartupLocation</a> property. Set this to <a href="http://msdn.microsoft.com/en-us/library/system.windows.windowstartuplocation.aspx" rel="noreferrer"><code>WindowStartupLocation.CenterOwner</code></a></p> <pre><code>AboutBox dialog = new AboutBox(); dialog.Owner = Application.Current.MainWindow; // We must also set the owner for this to work. dialog.WindowStartupLocation = WindowStartupLocation.CenterOwner; </code></pre> <p>If you want it to be centered horizontally, but not vertically (i.e. fixed vertical location), you will have to do that in an EventHandler after the AboutBox has been loaded because you will need to calculate the horizontal position depending on the Width of the AboutBox, and this is only known after it has been loaded.</p> <pre><code>protected override void OnInitialized(...) { this.Left = this.Owner.Left + (this.Owner.Width - this.ActualWidth) / 2; this.Top = this.Owner.Top + 20; } </code></pre> <p>gehho.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload