In This Article

Customizing Appearance

Several properties are available to customize the appearance of the control. The following additional customizations are also available:

The HeaderBackground, HeaderForeground, HeaderFontSize, HeaderBorderBrush, HeaderBorderThickness properties are available to customize the header.

When either the HeaderBackground or HeaderBorderBrush properties are populated, the layout of the Header and Status Image will automatically shift their vertical alignment for a consistent layout.

UserPromptBuilder defines equivalent methods to set these properties with the builder pattern (e.g., WithHeaderBackground and WithHeaderForeground). For any IBrush-based property, one method overload will accept an IBrush and the other will accept a Color that will automatically be converted to a SolidColorBrush.

Images

Any ImageSource can be set to the StatusImageSource or FooterImageSource properties for a custom look. When using the builder pattern, set the ImageSource using WithStatusImage or WithFooterImage.

The images used by UserPromptStandardImage can also be customized by assigning a custom ImageProvider to the ImageProvider.Default property. Each value for UserPromptStandardImage corresponds to a key of the same name defined by SharedImageSourceKeys. For example, the image UserPromptStandardImage.Warning corresponds to the key SharedImageSourceKeys.Warning. A custom class which derives from ImageProvider can override the ImageProvider.GetImageSource method to return a custom ImageSource for one or more of those keys.

Customize UserPromptWindow

The UserPromptWindow does not have a public constructor and is only created by the UserPromptWindow.ShowDialog method. One of the arguments for ShowDialog allows you to pass an Action<UserPromptWindow> which is invoked with a reference to the UserPromptWindow after it is configured, but before it is shown. This callback allows the UserPromptWindow to be customized.

The following code demonstrates using the callback to customize the flow direction of the window:

var userPromptControl = new UserPromptControl() { ... };
Window owner = null; // Use default

UserPromptWindow.ShowDialog(
	userPromptControl,
	"Window Title",
	owner,
	window => {
		window.FlowDirection = FlowDirection.RightToLeft;
	});

The builder pattern exposes the same customization using the AfterInitializeWindow callback as shown in the following example:

UserPromptBuilder.Configure()
	// ... other configuration options here
	.AfterInitializeWindow(window => {
		window.FlowDirection = FlowDirection.RightToLeft;
	})
	.Show();

Finally, an advanced configuration of ThemedMessageBox also allows access to the builder pattern as shown below:

ThemedMessageBox.Show(
	"Use the optional 'configure' parameter to access the UserPromptBuilder."
	configure: builder => builder
		.AfterInitializeWindow(window => {
			window.FlowDirection = FlowDirection.RightToLeft;
		})
	);

Theme Assets

See the Theme Reusable Assets topic for more details on using and customizing theme assets. The following reusable assets are used by UserPromptControl:

Asset Resource Key Description
ContainerForegroundLowestNormalBrushKey Assigned to the following properties: Foreground.
ContainerBackgroundLowestBrushKey Assigned to the following properties: Background.
ContainerForegroundLowNormalBrushKey Assigned to the following properties: TrayForeground.
ContainerBackgroundLowBrushKey Assigned to the following properties: TrayBackground.
ContainerBorderLowBrushKey Assigned to the following properties: BorderBrush.
PrimaryAccentForegroundLowestNormalBrushKey Assigned to the following properties: HeaderForeground.
ExtraLargeFontSizeDoubleKey Assigned to the following properties: HeaderFontSize.
ContainerForegroundLowDisabledBrushKey Used for the focus rectangle of the Expanded Information toggle.
ButtonForegroundHoverBrushKey Assigned to the following properties of the Expanded Information toggle when the mouse is over the control: Foreground.
ButtonForegroundPressedBrushKey Assigned to the following properties of the Expanded Information toggle when pressed: Foreground.
ContainerForegroundLowDisabledBrushKey Assigned to the following properties of the Expanded Information toggle when disabled: Foreground.