Chapter.Net.WPF.MessageBoxes
1.1.0
See the version list below for details.
dotnet add package Chapter.Net.WPF.MessageBoxes --version 1.1.0
NuGet\Install-Package Chapter.Net.WPF.MessageBoxes -Version 1.1.0
<PackageReference Include="Chapter.Net.WPF.MessageBoxes" Version="1.1.0" />
paket add Chapter.Net.WPF.MessageBoxes --version 1.1.0
#r "nuget: Chapter.Net.WPF.MessageBoxes, 1.1.0"
// Install Chapter.Net.WPF.MessageBoxes as a Cake Addin #addin nuget:?package=Chapter.Net.WPF.MessageBoxes&version=1.1.0 // Install Chapter.Net.WPF.MessageBoxes as a Cake Tool #tool nuget:?package=Chapter.Net.WPF.MessageBoxes&version=1.1.0
<img src="https://raw.githubusercontent.com/dwndland/Chapter.Net.WPF.MessageBoxes/master/Icon.png" alt="logo" width="64"/>
Chapter.Net.WPF.MessageBoxes Library
Overview
The System.Windows.MessageBox to use within WPF has two big problems. First is that it looks like windows Classic and it lacks a lot of features. Here the Chapter.Net.WPF.MessageBoxes library steps in. Thats a custom message box made out of a WPF window. It has a lot of additonal features, see below, and it brings build in styles and allows custom styling.
Preview
(Some button labels are n German because the screenshots are made on a German windows)
- Example 1
- Example 2
- Example 3
- Example 4
- Example 5
- Example 6
Features
- Styling: Build in Light and Dark style and allow passing custom styles.
- Window Settings: Settings like show in task bar, minimum and maximum sizes, resize modes and more.
- Additional Buttons: Buttons like Yes To All, Try Again and some more.
- Do not show again checkbox: Checkbox shown on the bottom left for configure a do not show again.
- Details: Allow expanding and collapsing an area to display details.
- Clipboard: Like the original, pressing CTRL+C copies all shown in the message box to the clipboard. That contains the optional details section.
- Localization: All buttons shown can be localized manually. Those who are available by windows are also auto translated if needed.
Getting Started
Installation:
- Install the Chapter.Net.WPF.MessageBoxes library via NuGet Package Manager:
dotnet add package Chapter.Net.WPF.MessageBoxes
Usage:
- Simply use the Chapter.WPF.MessageBox like you would use the build in.
var result = MessageBox.Show(ownerWindow, "Message", "Caption", MessageBoxButtons.YesNo); if (result == MessageBoxResult.Yes) { }
Styling:
- With build in dark style
var options = new MessageBoxOptions(); options.WindowOptions.Theme = WindowTheme.Dark; // The window title bar options.Styles.Theme = WindowTheme.Dark; // The controls MessageBox.Show(this, "Message", "Caption", options);
- With custom styles
var options = new MessageBoxOptions(); options.WindowOptions.Theme = WindowTheme.Dark; // The window title bar options.Styles.ButtonStyle = myButtonStyle; MessageBox.Show(this, "Message", "Caption", options);
Localization:
- Translate yes and no buttons
var options = new MessageBoxOptions(); options.Strings.Yes = "Yay"; options.Strings.No = "Nay"; MessageBox.Show(this, "Message", "Caption", options);
Details:
- Show call stack in details pane
var options = new MessageBoxOptions(); options.ShowDetails = true; options.DetailsText = Environment.StackTrace; MessageBox.Show(this, "See Details", "Error", options);
Do not show again:
- Add the checkbox and save it accordingly
var options = new MessageBoxOptions(); options.ShowDoNotShowAgainCheckBox = true; var result = MessageBox.Show(this, "You want to close the application?", "Close", options); system.DoNotShowAgain = options.IsDoNotShowAgainChecked;
Example
Save single or all
public class MainViewModel { public void SaveAll() { var options = new MessageBoxOptions(); options.ShowYesToAllButton = true; var result = MessageBox.Show(this, "Save changed files?", "Save", MessageBoxButtons.YesNo, options); switch (result) { case MessageBoxResult.Yes: SaveCurrentFile(); break; case MessageBoxResult.YesToAll: SaveAllFiles(); break; case MessageBoxResult.No: break; } } }
Do not show again
public class MainViewModel { public void TryShutdown() { if (!Settings.DoNotShowAgain) { var options = new MessageBoxOptions(); options.ShowDoNotShowAgainCheckBox = true; var result = MessageBox.Show(this, "You want to close the application?", "Close", options); Settings.DoNotShowAgain = options.IsDoNotShowAgainChecked; if (result == MessageBoxResult.Yes) Shutdown(); } else Shutdown(); } }
Links
License
Copyright (c) David Wendland. All rights reserved. Licensed under the MIT License. See LICENSE file in the project root for full license information.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net5.0-windows7.0 is compatible. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net6.0-windows7.0 is compatible. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net7.0-windows7.0 is compatible. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net8.0-windows7.0 is compatible. |
.NET Core | netcoreapp3.0 is compatible. netcoreapp3.1 was computed. |
.NET Framework | net45 is compatible. net451 was computed. net452 was computed. net46 was computed. net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
-
.NETCoreApp 3.0
- Chapter.Net.WPF (>= 1.1.0)
-
.NETFramework 4.5
- Chapter.Net.WPF (>= 1.1.0)
-
net5.0-windows7.0
- Chapter.Net.WPF (>= 1.1.0)
-
net6.0-windows7.0
- Chapter.Net.WPF (>= 1.1.0)
-
net7.0-windows7.0
- Chapter.Net.WPF (>= 1.1.0)
-
net8.0-windows7.0
- Chapter.Net.WPF (>= 1.1.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.