Creates WPF dialog windows including modal dialogs, MessageBox, and common dialogs. Use when implementing confirmation prompts, settings windows, or file/folder pickers.
View on GitHubchristian289/dotnet-with-claudecode
wpf-dev-pack
January 23, 2026
Select agents to install to:
npx add-skill https://github.com/christian289/dotnet-with-claudecode/blob/main/wpf-dev-pack/skills/creating-wpf-dialogs/SKILL.md -a claude-code --skill creating-wpf-dialogsInstallation paths:
.claude/skills/creating-wpf-dialogs/# WPF Dialog Patterns
Creating and managing dialog windows for user interaction.
**Advanced Patterns:** See [ADVANCED.md](ADVANCED.md) for MVVM dialog service, modeless dialogs, and input dialogs.
## 1. Dialog Types Overview
```
Dialog Types
├── Modal Dialogs (ShowDialog)
│ ├── Custom Window dialogs
│ └── MessageBox
├── Modeless Dialogs (Show)
│ └── Tool windows, floating panels
└── Common Dialogs
├── OpenFileDialog
├── SaveFileDialog
└── FolderBrowserDialog
```
---
## 2. MessageBox
### 2.1 Basic Usage
```csharp
// Simple message
MessageBox.Show("Operation completed successfully.");
// With title
MessageBox.Show("File saved.", "Success");
// With buttons
var result = MessageBox.Show(
"Do you want to save changes?",
"Confirm",
MessageBoxButton.YesNoCancel);
// With icon
MessageBox.Show(
"An error occurred.",
"Error",
MessageBoxButton.OK,
MessageBoxImage.Error);
```
### 2.2 MessageBox Options
**Buttons:**
| Value | Buttons |
|-------|---------|
| OK | OK |
| OKCancel | OK, Cancel |
| YesNo | Yes, No |
| YesNoCancel | Yes, No, Cancel |
**Icons:**
| Value | Icon |
|-------|------|
| None | No icon |
| Information | Info circle |
| Warning | Warning triangle |
| Error | Red X |
### 2.3 Processing Results
```csharp
var result = MessageBox.Show(
"Are you sure you want to delete this item?",
"Confirm Delete",
MessageBoxButton.YesNo,
MessageBoxImage.Warning,
MessageBoxResult.No); // Default button
switch (result)
{
case MessageBoxResult.Yes:
DeleteItem();
break;
case MessageBoxResult.No:
// Cancelled
break;
}
```
---
## 3. Custom Modal Dialog
### 3.1 Dialog Window XAML
```xml
<Window x:Class="MyApp.Dialogs.SettingsDialog"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Settings"
Width="400" Height="300"
WindowStartupLocation="Cente