Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Custom Message Box

Tags:

c#

wpf

Is it possible to create my own custom MessageBox where I would be able to add images instead of only strings?

like image 646
sikas Avatar asked Jul 03 '10 01:07

sikas


People also ask

What is message box in C#?

MessageBox is a class in C# and Show is a method that displays a message in a small window in the center of the Form. MessageBox is used to provide confirmations of a task being done or to provide warnings before a task is done. Create a Windows Forms app in Visual Studio and add a button on it.


2 Answers

I also wanted this feature, so I created WPFCustomMessageBox, a WPF clone of the native Windows/.NET MessageBox which supports extra features like custom button text.

WPFCustomMessageBox uses static methods just like the standard .NET MessageBox, so you can plug-and-play the new library without modifying any code. Most importantly, I designed this control so it looks identical to the original MessageBox.

WPFCustomMessageBox example

I created this library because I wanted to use verbs for my MessageBox buttons to help users better understand the functionality of the buttons. With this library, you can offer your users button descriptions like Save/Don't Save or Eject Fuel Rods/Don't do it! rather than the standard OK/Cancel or Yes/No (although you can still use those too, if you like).

The WPFCustomMessageBox message boxes return standard .NET MessageBoxResults. It also offers the same features as the original MessageBox like MessageBoxIcons and custom message box captions.

WPFCustomMessageBox is open source, so you can grab the code or make improvements here: https://github.com/evanwon/WPFCustomMessageBox

You can add WPFCustomMessage to your project via NuGet: https://www.nuget.org/packages/WPFCustomMessageBox/

like image 179
Evan Wondrasek Avatar answered Sep 17 '22 03:09

Evan Wondrasek


Check theses articles which shows how create custom dialogs using WPF

  • WPF Common TaskDialog for Vista and XP.

alt text
(source: wordpress.com)

  • WPF MessageBox - Custom control
like image 30
RRUZ Avatar answered Sep 18 '22 03:09

RRUZ