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 image, and optional footer image
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 images
- Header
- Footer with optional image
- 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.
ThemedMessageBox
The ThemedMessageBox 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 ThemedMessageBox to prompt the user with a question:
var result = ThemedMessageBox.Show(
"The specified file already exists. Do you want to overwrite the file?",
"Overwrite existing file?",
MessageBoxButton.YesNo,
MessageBoxImage.Question);
See the ThemedMessageBox topic for more information.
Builder Pattern
While ThemedMessageBox satisfies most prompting needs, UserPromptControl provides additional layout and customization options, like checkbox or footer, that are not covered by the ThemedMessageBox 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 image, and a checkbox:
var result = UserPromptBuilder.Configure()
.WithHeaderContent("Overwrite existing file?")
.WithContent("The specified file already exists. Do you want to overwrite the file?")
.WithStandardButtons(UserPromptStandardButtons.YesNo)
.WithStatusImage(UserPromptStandardImage.Question)
.WithCheckBoxContent("_Always overwrite files")
.Show();
See the Builder Pattern topic for more information.