You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
.NET Framework 4.0 or later / .NET Core 3.0 or later
Step 1: Install the NuGet Package
Install via NuGet Package Manager or Package Manager Console:
Install-Package WPFDevelopers
Note: For the latest features, use the preview package:
Install-Package WPFDevelopers -Pre
Or in Visual Studio: right-click your project β Manage NuGet Packages β search WPFDevelopers β Install.
Step 2: Configure App.xaml
Add the WD namespace and theme resources in App.xaml:
<Applicationx:Class="YourApp.App"xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"xmlns:wd="https://github.com/WPFDevelopersOrg/WPFDevelopers"StartupUri="MainWindow.xaml">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<!-- 1. Theme must be imported first -->
<ResourceDictionarySource="pack://application:,,,/WPFDevelopers;component/Themes/Theme.xaml" />
<!-- 2. wd:Resources must come AFTER Theme.xaml -->
<wd:ResourcesRadius="4" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
</Application>
Theme Configuration
<wd:Resources /> supports the following modes:
Configuration
Effect
<wd:Resources Radius="4" />
Default Light theme, 4px control corner radius (follows system Light/Dark on Windows 10+)
<wd:Resources Theme="Light" Radius="4" />
Fixed light theme, 4px corner radius
<wd:Resources Theme="Dark" Radius="4" />
Fixed dark theme, 4px corner radius
<wd:Resources Color="Fuchsia" Radius="4" />
Custom theme color, 4px corner radius
Tip: The Radius property controls the corner radius of controls. Windows 11 defaults to 4px, Windows 10 defaults to 0px. Adjust as needed.
Important: wd:Resources must be placed afterTheme.xaml in MergedDictionaries, otherwise the theme will not load correctly.
WD provides a set of theme resources you can reference in XAML:
Resource Key
Type
Description
WD.PrimaryBrush
SolidColorBrush
Primary color
WD.SuccessBrush
SolidColorBrush
Success color
WD.WarningBrush
SolidColorBrush
Warning color
WD.DangerBrush
SolidColorBrush
Danger color
WD.InfoSolidColorBrush
SolidColorBrush
Info color
WD.LightBrush
SolidColorBrush
Light color
WD.CircularSingularSolidColorBrush
SolidColorBrush
Circular accent color
WD.BackgroundBrush
SolidColorBrush
Background color
WD.PrimaryTextBrush
SolidColorBrush
Primary text color
WD.WarningGeometry
Geometry
Warning icon
Complete Control Catalog
Important: Controls marked π‘ Sample-only are defined in WPFDevelopers.Samples.Shared/Controls/ and are NOT part of the NuGet package (wd: namespace). They are only available in the sample project. All other controls can be used directly via the wd: prefix after NuGet installation.
MessageBox is a static message dialog class provided by WPFDevelopers, designed as a drop-in replacement for System.Windows.MessageBox with a more polished and customizable appearance.
Note: MessageBox is a static class, not a XAML control. It can only be called from C# code.
Import the Namespace
To avoid conflicts with System.Windows.MessageBox, use an alias:
// 1. Message text only (default OK button, no icon)MessageBoxResultShow(stringmessageBoxText,Windowowner=null,double?buttonRadius=null,boolisDefault=true)// 2. Message text + captionMessageBoxResultShow(stringmessageBoxText,stringcaption,Windowowner=null,double?buttonRadius=null,boolisDefault=true)// 3. Message text + caption + buttonsMessageBoxResultShow(stringmessageBoxText,stringcaption,MessageBoxButtonbutton,Windowowner=null,double?buttonRadius=null,boolisDefault=true)// 4. Message text + caption + iconMessageBoxResultShow(stringmessageBoxText,stringcaption,MessageBoxImageicon,Windowowner=null,double?buttonRadius=null,boolisDefault=true)// 5. Message text + caption + buttons + icon (full signature)MessageBoxResultShow(stringmessageBoxText,stringcaption,MessageBoxButtonbutton,MessageBoxImageicon,Windowowner=null,double?buttonRadius=null,boolisDefault=true)
Parameters
Parameter
Type
Default
Description
messageBoxText
string
β
Message content
caption
string
β
Dialog title
button
MessageBoxButton
OK
Button set: OK / OKCancel / YesNo / YesNoCancel
icon
MessageBoxImage
None
Icon type: Information / Warning / Error / Question
owner
Window
null
Parent window. When provided, the dialog centers on the owner with an overlay mask
buttonRadius
double?
null
Button corner radius in pixels. When null, auto-detects OS: Windows 11 defaults to 4px, Windows 10 defaults to 0px
isDefault
bool
true
Whether the first button is the default button (triggered by Enter key)
Icon and Color Mapping
MessageBoxImage
Icon
Color
Information
Info icon
Success (green)
Warning
Warning icon
Warning (orange)
Error
Error icon
Danger (red)
Question
Question icon
Primary (blue)
Usage Examples
1. Information Dialog
// File deleted successfully, with rounded buttonsMessageBox.Show("File deleted successfully.","Message",MessageBoxButton.OK,MessageBoxImage.Information,buttonRadius:4);
2. Warning Dialog
// Uses default OK buttonMessageBox.Show("Performing this action may cause the file to become inaccessible!","Warning",MessageBoxImage.Warning);
3. Error Dialog
MessageBox.Show("The file does not exist.","Error",MessageBoxImage.Error);
4. Confirmation Dialog (with Result Handling)
varresult=MessageBox.Show("The file does not exist. Continue?","Confirm",MessageBoxButton.YesNoCancel,MessageBoxImage.Question);switch(result){caseMessageBoxResult.Yes:// User clicked "Yes"break;caseMessageBoxResult.No:// User clicked "No"break;caseMessageBoxResult.Cancel:// User clicked "Cancel" or closed the dialogbreak;}
5. With Owner Window (with Overlay Mask)
// When owner is passed, the dialog centers on the parent window and shows an overlay maskMessageBox.Show("Operation successful!","Info",MessageBoxButton.OK,MessageBoxImage.Information,owner:this,buttonRadius:4);
Interaction Behavior
Close methods: Click the close button (top-right), press Escape, or click any button
Owner window: When owner is provided, the dialog centers on the parent window and displays a mask overlay. Without an owner, it auto-detects the current window or centers on screen
Button text: Automatically localized via LanguageManager (follows system language)
SplitButton Usage Tutorial
SplitButton is a split button control provided by WPFDevelopers. The left side is a clickable main button area, and the right side is a dropdown toggle button. It supports both text options and rich content options with icons.
// ViewModel or Code-behindpublicObservableCollection<string>MenuItems{get;}=newObservableCollection<string>{"Save in PDF","Save in Word","Save in Excel","Save in Image"};privatevoidSplitButton_SelectionChanged(objectsender,RoutedPropertyChangedEventArgs<object>e){// e.NewValue is the selected item}
GrayscaleEffect is a pixel shader effect that converts any visual element to grayscale display, commonly used for global grayscale mode (e.g., memorial days).