Includes MessageBox with a more modern interface and rich text support, InputBox, can auto-closing Prompt Window.
包括支持富文本的更现代化界面的消息框、输入框、可自动关闭的提示窗。
Download package from Nuget, or using the release Dll.
Except for the absence of the MessageBoxOptions parameter, all other features are seamlessly integrated with the original version.
using MessageBox = MessageWindowWPF.MessageBox; //Just add the namespace
MessageBox.Show("Message!");
MessageBox.Show("Message2!", "Tip", MessageBoxButton.OK, MessageBoxImage.Information);
If you want to display rich text, you can also just pass in the parameters:
using MessageBox = MessageWindowWPF.MessageBox;
List<Inline> inlines = new List<Inline>();
inlines.Add(new Run("normal text. "));
inlines.Add(new Run("red text.") { Foreground = Brushes.Red });
MessageBox.Show(inlines, "Tip", MessageBoxButton.OK, MessageBoxImage.Information);
Some configurations can also be customized:
using MessageWindowWPF;
using MessageBox = MessageWindowWPF.MessageBox;
MessageSetting.settings.NoSystemHeader = MessageSetting.settings.WithCornerRadius = true; //Without system title bar, and change to rounded corners
MessageSetting.settings.BackGroundColor = Colors.Black;
MessageBox.Show("Message!", "Tip", MessageBoxButton.OK, MessageBoxImage.Information);
Input box similar to VB's component.
using MessageWindowWPF;
InputBox inputBox = new InputBox();
if (inputBox.ShowDialog("Write Something:", "Title") == true)
Console.WriteLine(inputBox.value);
Function: inputBox.ShowDialog(string message = null, string title = null, string defaultValue = null)
, return bool?.
Some configurations can also be customized:
using MessageWindowWPF;
MessageSetting.settings.NoSystemHeader = MessageSetting.settings.WithCornerRadius = true;
MessageSetting.settings.BackGroundColor = Colors.Black;
InputBox inputBox = new InputBox();
if (inputBox.ShowDialog("Write Something:", "Title") == true)
Console.WriteLine(inputBox.value);
Fade-in and fade-out cues, support countdown and double click to close.
using MessageWindowWPF;
Prompt.Show("Show text");
Function: Prompt.Show(string content, double liveSeconds = 3, Window owner = null, Point? point = null, Color? backColor = null)
, return Window.
When the parameter value of "liveSeconds" <= 0, the window will be displayed until it is closed by double-clicking.
If you want to display rich text, you can also just pass in the parameters:
using MessageWindowWPF;
List<Inline> inlines = new List<Inline>();
inlines.Add(new Run("normal text. "));
inlines.Add(new Run("red text.") { Foreground = Brushes.Red });
Prompt.Show(inlines);
Custom configurations only have an effect on the color, but the color parameter of the function has a higher priority:
using MessageWindowWPF;
MessageSetting.settings.BackGroundColor = Colors.Black;
Prompt.Show("Show text");
- Because there are only four buttons, the current text only comes with Chinese and English. The default is displayed in the current language. Alternatively, you can set it manually by changing the value of "MessageSetting.settings.UIculture".
- v1.0.0 2022/12/07 Basic features.
从Nuget下载包,或者引用release的Dll。
除了没有 MessageBoxOptions 参数之外,其他功能都与原版无缝衔接。
using MessageBox = MessageWindowWPF.MessageBox; //添加这行即可
MessageBox.Show("消息!");
MessageBox.Show("消息2!", "提示", MessageBoxButton.OK, MessageBoxImage.Information);
using MessageBox = MessageWindowWPF.MessageBox;
List<Inline> inlines = new List<Inline>();
inlines.Add(new Run("普通文本。 "));
inlines.Add(new Run("红色文本。") { Foreground = Brushes.Red });
MessageBox.Show(inlines, "提示", MessageBoxButton.OK, MessageBoxImage.Information);
还可以自定义一些配置:
using MessageWindowWPF;
using MessageBox = MessageWindowWPF.MessageBox;
MessageSetting.settings.NoSystemHeader = MessageSetting.settings.WithCornerRadius = true;//不使用系统标题栏,以及变为圆角
MessageSetting.settings.BackGroundColor = Colors.Black;
MessageBox.Show("消息!", "提示", MessageBoxButton.OK, MessageBoxImage.Information);
using MessageWindowWPF;
InputBox inputBox = new InputBox();
if (inputBox.ShowDialog("输入提示:", "标题") == true)
Console.WriteLine(inputBox.value);
函数: inputBox.ShowDialog(string message = null, string title = null, string defaultValue = null)
, 返回 bool?。
还可以自定义一些配置:
using MessageWindowWPF;
MessageSetting.settings.NoSystemHeader = MessageSetting.settings.WithCornerRadius = true;
MessageSetting.settings.BackGroundColor = Colors.Black;
InputBox inputBox = new InputBox();
if (inputBox.ShowDialog("输入提示:", "标题") == true)
Console.WriteLine(inputBox.value);
using MessageWindowWPF;
Prompt.Show("提示文字");
函数: Prompt.Show(string content, double liveSeconds = 3, Window owner = null, Point? point = null, Color? backColor = null)
, 返回提示窗体。
当"liveSeconds" 的参数值<=0时,窗口将会一直显示直到双击关闭它。
using MessageWindowWPF;
List<Inline> inlines = new List<Inline>();
inlines.Add(new Run("普通文本。 "));
inlines.Add(new Run("红色文本。") { Foreground = Brushes.Red });
Prompt.Show(inlines);
自定义配置只有颜色有作用,但是调用函数的颜色参数优先级更高:
using MessageWindowWPF;
MessageSetting.settings.BackGroundColor = Colors.Black;
Prompt.Show("提示文字");
- 因为只有四个按钮,所以目前的文字只带有中文和英文。 默认按当前语言显示,另外还可以通过改变 MessageSetting.settings.UIculture 的值来手动设置它。
- v1.0.0 2022/12/07 基本功能.