Back to Skills

handling-wpf-input-commands

verified

Implements WPF input handling with RoutedCommand, ICommand, CommandBinding, and InputBinding patterns. Use when creating keyboard shortcuts, menu commands, or custom command implementations.

View on GitHub

Marketplace

dotnet-claude-plugins

christian289/dotnet-with-claudecode

Plugin

wpf-dev-pack

development

Repository

christian289/dotnet-with-claudecode
5stars

wpf-dev-pack/skills/handling-wpf-input-commands/SKILL.md

Last Verified

January 23, 2026

Install Skill

Select agents to install to:

Scope:
npx add-skill https://github.com/christian289/dotnet-with-claudecode/blob/main/wpf-dev-pack/skills/handling-wpf-input-commands/SKILL.md -a claude-code --skill handling-wpf-input-commands

Installation paths:

Claude
.claude/skills/handling-wpf-input-commands/
Powered by add-skill CLI

Instructions

# WPF Input and Commands Patterns

Handling user input and implementing command patterns in WPF applications.

## 1. Command System Overview

```
ICommand (Interface)
├── RoutedCommand (WPF built-in)
│   ├── ApplicationCommands (Copy, Paste, Cut, etc.)
│   ├── NavigationCommands (BrowseBack, BrowseForward, etc.)
│   ├── MediaCommands (Play, Pause, Stop, etc.)
│   └── EditingCommands (ToggleBold, ToggleItalic, etc.)
└── RelayCommand / DelegateCommand (MVVM)
```

---

## 2. Built-in Commands

### 2.1 ApplicationCommands

```xml
<Window.CommandBindings>
    <CommandBinding Command="ApplicationCommands.Copy"
                    Executed="CopyCommand_Executed"
                    CanExecute="CopyCommand_CanExecute"/>
    <CommandBinding Command="ApplicationCommands.Paste"
                    Executed="PasteCommand_Executed"/>
</Window.CommandBindings>

<StackPanel>
    <Button Command="ApplicationCommands.Copy" Content="Copy (Ctrl+C)"/>
    <Button Command="ApplicationCommands.Paste" Content="Paste (Ctrl+V)"/>
    <Button Command="ApplicationCommands.Undo" Content="Undo (Ctrl+Z)"/>
    <Button Command="ApplicationCommands.Redo" Content="Redo (Ctrl+Y)"/>
</StackPanel>
```

```csharp
private void CopyCommand_Executed(object sender, ExecutedRoutedEventArgs e)
{
    // Copy logic
    Clipboard.SetText(SelectedText);
}

private void CopyCommand_CanExecute(object sender, CanExecuteRoutedEventArgs e)
{
    // Enable condition
    e.CanExecute = !string.IsNullOrEmpty(SelectedText);
}
```

### 2.2 Common Built-in Commands

| Category | Commands |
|----------|----------|
| **ApplicationCommands** | New, Open, Save, SaveAs, Close, Print, Copy, Cut, Paste, Undo, Redo, Find, Replace, SelectAll, Delete, Properties, Help |
| **NavigationCommands** | BrowseBack, BrowseForward, BrowseHome, BrowseStop, Refresh, Favorites, Search, GoToPage, NextPage, PreviousPage, FirstPage, LastPage |
| **MediaCommands** | Play, Pause, Stop, Record, NextTrack, PreviousTrack, FastForward, Rewind, ChannelUp

Validation Details

Front Matter
Required Fields
Valid Name Format
Valid Description
Has Sections
Allowed Tools
Instruction Length:
9071 chars