WPF MessageBox Sample Creator

Real-time simulation of the standard Windows MessageBox. Pre-built .exe available on GitHub—start UI specification reviews without a dev environment.

Overview: Interactive MessageBox Simulator

The WPF MessageBox Sample Creator is a prototyping application that allows you to intuitively customize the standard MessageBox and preview its actual behavior instantly. Set the message text, caption, button set, icon, default result and display options, then show the dialog with exactly those settings.

Since pre-built executable files (.exe) are available on the GitHub Releases page, anyone can use the tool by simply downloading it—no Visual Studio or development environment required. The builds are framework-dependent, so the matching x64 .NET Desktop Runtime does have to be installed already; see System Requirements below.

WPF MessageBox Sample Creator main window with input fields for message text, caption, buttons, icon, and options

Background: Removing the “Build Barrier”

In WPF development, repeatedly writing code just to check the behavior of dialogs is inefficient. Furthermore, designers and architects often find it difficult to use tools that are only shared as source code, as setting up a build environment is a significant hurdle.

To solve this, this tool is distributed in a ready-to-run format. The tool uses WPF alone, with no third-party libraries and no custom styles, so the app ZIP of the latest release, v1.0.0.2, is about 200 KB.

Configurable Parameters

The arguments of the MessageBox.Show overload this tool calls are each exposed as an independent input, so combinations can be tried without editing and rebuilding code. The overloads that take an owner Window as their first argument are out of scope — the tool does not set an owner:

Parameter Type Effect
Message text string The body of the dialog. Useful for checking how long text wraps and how the dialog resizes.
Caption string The title bar text.
Buttons MessageBoxButton The button set. The list is the enum’s members on the runtime in use: the .NET 8 build offers four (OK, OKCancel, YesNoCancel, YesNo), and the .NET 10 build seven, adding AbortRetryIgnore, RetryCancel, and CancelTryContinue.
Icon MessageBoxImage The system icon shown beside the message. All nine member names are selectable.
Default result MessageBoxResult Which button is the default when the dialog opens — that is, what Enter activates. Every member of the enum is selectable here (ten on .NET 10), but the value only takes effect when the chosen button set contains that button. Showing every button set with every result on .NET 8.0.31 and 10.0.10, a result the dialog did not display always made the first button the default.
Options MessageBoxOptions Display options such as right-aligned text and right-to-left reading order. The list holds the enum’s five members and one is chosen at a time, so flags cannot be combined here.

What the Tool Makes Obvious: Nine Icon Names, Four Icons

MessageBoxImage has nine members, which suggests nine different icons are available. It is not the case. Several members share the same underlying numeric value, so they are indistinguishable at runtime — the enum simply offers alternative names for the same Win32 flag:

Enum members Value Icon actually displayed
None 0 No icon
Error / Hand / Stop 16 White X in a red circle
Question 32 Question mark in a circle
Exclamation / Warning 48 Exclamation point in a yellow triangle
Asterisk / Information 64 Lowercase i in a circle

The duplicates also show up in code. On .NET 8.0.31 and 10.0.10, the values from Enum.GetValues converted to strings as Hand three times, Exclamation twice, and Asterisk twice. A value shared by several names converts to only one of them, and .NET does not specify which, so another runtime may show a different name. Either way, a ComboBox bound to it would list the same name several times, which is why the tool builds its icon list from the nine names instead.

Selecting Error, Hand and Stop in turn and seeing the identical dialog each time settles a question that reading the enum definition tends to raise. It also means picking between those names is a readability decision for the code, not a visual one for the user.

One further caveat worth knowing before you reach for it: Microsoft documents the Question icon as no longer recommended, on the grounds that a question mark does not identify a category of message and can be mistaken for a help affordance. It remains in the enum for backward compatibility. For a confirmation prompt, Warning or no icon at all is the safer choice.

Measured Behavior

The enum members, the icon names, and the default buttons on this page were measured on .NET 8.0.31 and .NET 10.0.10 / Windows 11, using MessageBoxSampleCreatorScene in this site’s screenshot tool. The scene builds a small program for each runtime, calls MessageBox.Show without an owner as the tool does, and shows every button set with every MessageBoxResult. The default button was read from the dialog’s buttons by their control IDs, so the result does not depend on the language of the button text. No input was sent: each dialog was closed by clicking its first button through a window message.

case measured
.NET 8.0.31: MessageBoxButton OK, OKCancel, YesNoCancel, YesNo
.NET 8.0.31: MessageBoxResult None, OK, Cancel, Yes, No
.NET 8.0.31: MessageBoxOptions None, DefaultDesktopOnly, RightAlign, RtlReading, ServiceNotification
.NET 8.0.31: Enum.GetValues(MessageBoxImage) as text None, Hand, Hand, Hand, Question, Exclamation, Exclamation, Asterisk, Asterisk
.NET 10.0.10: MessageBoxButton OK, OKCancel, AbortRetryIgnore, YesNoCancel, YesNo, RetryCancel, CancelTryContinue
.NET 10.0.10: MessageBoxResult None, OK, Cancel, Abort, Retry, Ignore, Yes, No, TryAgain, Continue
.NET 10.0.10: MessageBoxOptions None, DefaultDesktopOnly, RightAlign, RtlReading, ServiceNotification
.NET 10.0.10: Enum.GetValues(MessageBoxImage) as text None, Hand, Hand, Hand, Question, Exclamation, Exclamation, Asterisk, Asterisk

The enum members behind the tool’s lists. Measured on .NET 8.0.31 and .NET 10.0.10 / Windows 11.

button set (buttons shown) defaultResult → default button
.NET 8.0.31: OK (OK) OK → OK
.NET 8.0.31: OKCancel (OK, Cancel) OK → OK; Cancel → Cancel
.NET 8.0.31: YesNoCancel (Yes, No, Cancel) Cancel → Cancel; Yes → Yes; No → No
.NET 8.0.31: YesNo (Yes, No) Yes → Yes; No → No
.NET 8.0.31: None or a result not in the set → first button 12 of 12 (of 20 dialogs shown)
.NET 10.0.10: OK (OK) OK → OK
.NET 10.0.10: OKCancel (OK, Cancel) OK → OK; Cancel → Cancel
.NET 10.0.10: AbortRetryIgnore (Abort, Retry, Ignore) Abort → Abort; Retry → Retry; Ignore → Ignore
.NET 10.0.10: YesNoCancel (Yes, No, Cancel) Cancel → Cancel; Yes → Yes; No → No
.NET 10.0.10: YesNo (Yes, No) Yes → Yes; No → No
.NET 10.0.10: RetryCancel (Retry, Cancel) Cancel → Cancel; Retry → Retry
.NET 10.0.10: CancelTryContinue (Cancel, TryAgain, Continue) Cancel → Cancel; TryAgain → TryAgain; Continue → Continue
.NET 10.0.10: None or a result not in the set → first button 54 of 54 (of 70 dialogs shown)

The default button for each button set and defaultResult. Measured on .NET 8.0.31 and .NET 10.0.10 / Windows 11.

How the Tool Is Built

The Show MessageBox. button makes a single call, MessageBox.Show(text, caption, button, icon, defaultResult, options), with the six values held by the view model. The lists for the button set, the default result, and the options are Enum.GetValues results bound through ObjectDataProvider, so they follow the enum of the runtime the build targets. That is why the .NET 10 build offers button sets that the .NET 8 build does not. The icon list is the exception described above.

The window uses WPF’s default styles. There is no Style in its XAML.

Typical Uses

System Requirements

Downloads & Repository

You can download the executable or browse the source code on GitHub:

🚀 Download Pre-built .exe (GitHub Releases)

View GitHub Repository (Source Code)