Overview
User Prompt provides a modern replacement for traditional MessageBox or Task Dialog functionality.
UserPromptControl with optional content areas labeled, OK/Cancel buttons, Information status icon, and optional footer icon
Features
Key features of User Prompt include:
- A UserPromptControl with comprehensive out-of-the-box capabilities to build rich prompts, including:
- Pre-defined and custom status icons
- Header
- Footer with optional icon
- Checkbox
- Expandable information with support for smooth animations
- Pre-defined commonly used buttons
- Support for custom buttons
- A simple and familiar MessageBox API for common prompts.
- A convenient UserPromptBuilder that uses a fluent API to easily configure and show complex prompts.
- Use extension methods to easily configure prompts like showing an
Exception
message with a stack trace. - Full support for Actipro Themes .
Controls
User Prompt functionality is primarily defined by two controls:
- UserPromptControl - A custom
Control
with properties to configure rich user prompts (pictured above). - UserPromptWindow - A
Window
specifically intended to host a UserPromptControl and show it as modal dialog on supported platforms.
Tip
While it is possible to directly instantiate and configure these controls, most users will want to use MessageBox or the builder pattern to configure and show a UserPromptControl.
MessageBox
The MessageBox class is intentionally designed to be consistent with the native WPF MessageBox
API and can be used to quickly display the most common prompts.
The following code demonstrates using MessageBox to prompt the user with a question:
var result = await MessageBox.Show(
"The specified file already exists. Do you want to overwrite the file?",
"Overwrite existing file?",
MessageBoxButtons.YesNo,
MessageBoxImage.Question);
See the MessageBox topic for more information.
Builder Pattern
While MessageBox satisfies most prompting needs, UserPromptControl provides additional layout and customization options, like checkbox or footer, that are not covered by the MessageBox API.
The builder pattern can be used to easily configure and show a fully-featured UserPromptControl.
The following code demonstrates creating a UserPromptControl with a header, message, Yes and No buttons, a Question status icon, and a checkbox:
var result = await UserPromptBuilder.Configure()
.WithHeaderContent("Overwrite existing file?")
.WithContent("The specified file already exists. Do you want to overwrite the file?")
.WithStandardButtons(MessageBoxButtons.YesNo)
.WithStatusIcon(MessageBoxImage.Question)
.WithCheckBoxContent("_Always overwrite files")
.Show();
See the Builder Pattern topic for more information.