Note that there are some explanatory texts on larger screens.

plurals
  1. POSize of MessageBox
    primarykey
    data
    text
    <p>How does .NET's <code>MessageBox</code> determine its size relative to the resolution of the screen on which it is displayed?</p> <p>I am writing a slightly more flexible dialog window for a WPF application. The layout of the window is layed out in a Grid:</p> <pre><code>+----------------- | auto: Header // A header for the dialog. +----------------- | auto: Content // can be any FrameworkElement. +----------------- | auto: BottomPanel // With buttons &lt;OK&gt;, &lt;Cancel&gt;, &lt;Delete&gt;, etc. +----------------- </code></pre> <p>The <code>Content</code>cell can be VERY large. In one of my use cases, the user wants to delete <em>x</em> elements from a list. The elements are then listed in the confirmation dialog. If there are many (let's say 50+) elements, the window can get large—too large for my taste.</p> <p>What I would like is a function that determines the <code>MaxHeight</code>and <code>MaxWidth</code>properties of the dialog window from the current screen in a way that mimics Microsoft's own <code>MessageBox</code>dialog.</p> <p>PS: I invoke the message dialog with the following <code>static</code> method:</p> <pre><code>// MessageDialog class public static object Show( Window owner, FrameworkElement content, string title, string header, params MessageDialogButton[] buttons ); /* The MessageDialogButton class has the following properties: * Text, ReturnValue, IsDefault, IsCancel. The class produces * System.Windows.Controls.Button objects that when clicked * return the value of their ReturnValue property--which is then * returned by MessageDialog::Show(...) */ </code></pre> <p>PPS: To determine the screen on which to display the dialog, the screen on which the <code>MessageDialog</code> window's <code>Owner</code> is located. As a fallback, the first (primary) screen is used.</p>
    singulars
    1. This table or related slice is empty.
    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.
 

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