Handling Wpf Input Commands
БесплатноБез исполняемых скриптовНе проверенImplements WPF input handling with RoutedCommand, ICommand, CommandBinding, and InputBinding patterns. Use when creating keyboard shortcuts, menu commands, or…
от christian289★ 42 звезды на GitHubОб этом скилле
WPF Input and Commands Patterns
MVVM Framework Rule:
.claude/rules/dotnet/wpf/mvvm-framework.md설정에 따라 코드 스타일이 결정됩니다. Prism 9 사용 시 → PRISM.md 참조
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
<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>
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, ChannelDown, TogglePlayPause, IncreaseVolume, DecreaseVolume, MuteVolume |
| EditingCommands | ToggleBold, ToggleItalic, ToggleUnderline, IncreaseFontSize, DecreaseFontSize, AlignLeft, AlignCenter, AlignRight, AlignJustify |
Advanced: See ADVANCED.md for custom RoutedCommand creation, keyboard/mouse event handling (PreviewKeyDown, drag logic), and FocusManager patterns.
3. InputBinding (Keyboard/Mouse Shortcuts)
3.1 KeyBinding
<Window.InputBindings>
<!-- Keyboard shortcut -->
<KeyBinding Key="N" Modifiers="Control" Command="ApplicationCommands.New"/>
<KeyBinding Key="S" Modifiers="Control" Command="ApplicationCommands.Save"/>
<KeyBinding Key="S" Modifiers="Control+Shift" Command="ApplicationCommands.SaveAs"/>
<KeyBinding Key="F4" Modifiers="Alt" Command="ApplicationCommands.Close"/>
<!-- Function keys -->
<KeyBinding Key="F1" Command="ApplicationCommands.Help"/>
<KeyBinding Key="F5" Command="{x:Static cmd:CustomCommands.RefreshData}"/>
<!-- MVVM Command binding -->
<KeyBinding Key="Delete" Command="{Binding DeleteCommand}"/>
</Window.InputBindings>
3.2 MouseBinding
<Border.InputBindings>
<!-- Double-click -->
<MouseBinding MouseAction="LeftDoubleClick"
Command="{Binding OpenDetailCommand}"/>
<!-- Middle click -->
<MouseBinding MouseAction="MiddleClick"
Command="{Binding CloseTabCommand}"/>
<!-- Ctrl + Left click -->
<MouseBinding MouseAction="LeftClick"
Modifiers="Control"
Command="{Binding MultiSelectCommand}"/>
</Border.InputBindings>
4. CommandParameter
4.1 Static Parameter
<Button Command="{Binding NavigateCommand}"
CommandParameter="Home"
Content="Go to Home"/>
<Button Command="{Binding SetZoomCommand}"
CommandParameter="100"
Content="Zoom 100%"/>
4.2 Binding Parameter
<ListBox x:Name="ItemList" ItemsSource="{Binding Items}"/>
<Button Command="{Binding DeleteCommand}"
CommandParameter="{Binding SelectedItem, ElementName=ItemList}"
Content="Delete Selected"/>
<!-- Self-reference -->
<Button Command="{Binding ProcessCommand}"
CommandParameter="{Binding RelativeSource={RelativeSource Self}}"
Content="Process This Button"/>
5. CommandTarget
5.1 Redirecting Command Target
<StackPanel>
<TextBox x:Name="TargetTextBox"/>
<!-- Commands target the TextBox even when button is focused -->
<Button Command="ApplicationCommands.Copy"
CommandTarget="{Binding ElementName=TargetTextBox}"
Content="Copy from TextBox"/>
<Button Command="ApplicationCommands.Paste"
CommandTarget="{Binding ElementName=TargetTextBox}"
Content="
Установить Handling Wpf Input Commands в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл Handling Wpf Input Commands?
Implements WPF input handling with RoutedCommand, ICommand, CommandBinding, and InputBinding patterns. Use when creating keyboard shortcuts, menu commands, or custom command implementations.
Как установить скилл Handling Wpf Input Commands?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл Handling Wpf Input Commands запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
theme-factory
Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
от Anthropicaccess
Manage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropicconfigure
Set up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
от Anthropicaccess
Manage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropic