WpfMessageBox 2.0.0

dotnet add package WpfMessageBox --version 2.0.0
                    
NuGet\Install-Package WpfMessageBox -Version 2.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="WpfMessageBox" Version="2.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="WpfMessageBox" Version="2.0.0" />
                    
Directory.Packages.props
<PackageReference Include="WpfMessageBox" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add WpfMessageBox --version 2.0.0
                    
#r "nuget: WpfMessageBox, 2.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package WpfMessageBox@2.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=WpfMessageBox&version=2.0.0
                    
Install as a Cake Addin
#tool nuget:?package=WpfMessageBox&version=2.0.0
                    
Install as a Cake Tool

WpfMessageBox

Nuget Workflow status

Description

WpfMessageBox is a WPF message box implementation, aimed to be visually balanced between the default WPF style and the native .NET MessageBox. It offers the following features:

  • Returns an equivalent of the standard .NET MessageBoxResults.
  • Uses an equivalent of the standard MessageBox icons.
  • Ability to define custom buttons text.
  • Optional header text.
  • Optional TextBox.
  • Optional CheckBox.

Screenshot 1 Screenshot 2

Usage

  1. Install through Nuget

  2. WpfMessageBox uses static methods like the standard .NET MessageBox:

    using WpfMessageBoxLibrary;
    
    WpfMessageBoxResult result = WpfMessageBox.Show("Some text", "Some title", WpfMessageBoxButton.OK, WpfMessageBoxImage.Exclamation);
    
  3. In order to use the extra features offered by WpfMessageBox, you need to initialize a new WpfMessageBoxProperties which will hold the desired properties, then use the relevant static method:

    using WpfMessageBoxLibrary;
    
    var msgProperties = new WpfMessageBoxProperties() {
        Button = WpfMessageBoxButton.OKCancel,
        ButtonOkText = "Set name",
        CheckBoxText = "Don't ask again",
        Image = WpfMessageBoxImage.Exclamation,
        Header = "No name defined",
        IsCheckBoxChecked = true,
        IsCheckBoxVisible = true,
        IsTextBoxVisible = true,
        Text = "Please enter the name to use. You can leave the field empty in order to continue using the default name.",
        Title = "A nice example",
    };
    
    WpfMessageBoxResult result = WpfMessageBox.Show(this, ref msgProperties);
    
  4. The WpfMessageBoxProperties object allows you to retrieve the TextBox and CheckBox values after the user closed the message box:

    bool checkBoxChecked = msgProperties.IsCheckBoxChecked;
    string textBoxContent = msgProperties.TextBoxText;
    

More examples can be found in the Demo project of this repository.

Release notes

See the changelog.

License

WpfMessageBox is licensed under the MIT license - see the LICENSE file for details.

Credits

Some icons by Yusuke Kamiyamane licensed under a Creative Commons Attribution 3.0 License.

Product Compatible and additional computed target framework versions.
.NET net9.0-windows7.0 is compatible.  net10.0-windows was computed.  net10.0-windows7.0 is compatible. 
.NET Framework net48 is compatible.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETFramework 4.8

    • No dependencies.
  • net10.0-windows7.0

    • No dependencies.
  • net9.0-windows7.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories (1)

Showing the top 1 popular GitHub repositories that depend on WpfMessageBox:

Repository Stars
Otiel/BandcampDownloader
A Windows app used to download albums from Bandcamp.
Version Downloads Last Updated
2.0.0 492 11/29/2025
1.3.0 606 10/19/2025
1.2.0 7,068 6/14/2019
1.1.1 767 6/10/2019
1.1.0 749 6/10/2019

See CHANGELOG on source repository.