From wpf-dev-pack
Generates boilerplate WPF Behavior<T> classes using Microsoft.Xaml.Behaviors.Wpf for reusable UI interactions like focus management, drag, or input handling on controls. Usage: /wpf-dev-pack:make-wpf-behavior <BehaviorName>
How this skill is triggered — by the user, by Claude, or both
Slash command
/wpf-dev-pack:make-wpf-behaviorhaikuThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
**If `$0` is empty, use the AskUserQuestion tool to ask: "Enter the Behavior name (e.g., SelectAllOnFocus, DragMove)". Do NOT proceed until a valid name is provided. Use the response as the BehaviorName for all subsequent steps.**
If $0 is empty, use the AskUserQuestion tool to ask: "Enter the Behavior name (e.g., SelectAllOnFocus, DragMove)". Do NOT proceed until a valid name is provided. Use the response as the BehaviorName for all subsequent steps.
Generate a $0Behavior class based on Microsoft.Xaml.Behaviors.Wpf.
{TargetType} with the appropriate WPF type (e.g., TextBox, UIElement, Window) based on the behavior name and context.{Namespace} with the project's root namespace detected from csproj or existing code.{Project} with the target project path.namespace {Namespace}.Behaviors;
public sealed class $0Behavior : Behavior<{TargetType}>
{
#region Dependency Properties
public static readonly DependencyProperty IsEnabledProperty =
DependencyProperty.Register(
nameof(IsEnabled),
typeof(bool),
typeof($0Behavior),
new PropertyMetadata(true));
public bool IsEnabled
{
get => (bool)GetValue(IsEnabledProperty);
set => SetValue(IsEnabledProperty, value);
}
#endregion
#region Lifecycle
protected override void OnAttached()
{
base.OnAttached();
AssociatedObject.Loaded += OnLoaded;
}
protected override void OnDetaching()
{
base.OnDetaching();
AssociatedObject.Loaded -= OnLoaded;
}
#endregion
#region Event Handlers
private void OnLoaded(object sender, RoutedEventArgs e)
{
if (!IsEnabled)
{
return;
}
// TODO: Implement behavior logic
}
#endregion
}
<Window xmlns:b="http://schemas.microsoft.com/xaml/behaviors"
xmlns:behaviors="clr-namespace:{Namespace}.Behaviors">
<{TargetType}>
<b:Interaction.Behaviors>
<behaviors:$0Behavior IsEnabled="{Binding IsBehaviorEnabled}"/>
</b:Interaction.Behaviors>
</{TargetType}>
</Window>
public sealed class FocusOnLoadBehavior : Behavior<UIElement>
{
protected override void OnAttached()
{
base.OnAttached();
AssociatedObject.Loaded += (s, e) => AssociatedObject.Focus();
}
}
public sealed class EnterKeyBehavior : Behavior<TextBox>
{
public static readonly DependencyProperty CommandProperty =
DependencyProperty.Register(nameof(Command), typeof(ICommand),
typeof(EnterKeyBehavior));
public ICommand? Command
{
get => (ICommand?)GetValue(CommandProperty);
set => SetValue(CommandProperty, value);
}
protected override void OnAttached()
{
base.OnAttached();
AssociatedObject.KeyDown += OnKeyDown;
}
protected override void OnDetaching()
{
base.OnDetaching();
AssociatedObject.KeyDown -= OnKeyDown;
}
private void OnKeyDown(object sender, KeyEventArgs e)
{
if (e.Key == Key.Enter)
{
Command?.Execute(AssociatedObject.Text);
}
}
}
<PackageReference Include="Microsoft.Xaml.Behaviors.Wpf" Version="1.1.*" />
{Project}/
└── Behaviors/
└── $0Behavior.cs
| DO | DON'T |
|---|---|
| Unsubscribe events in OnDetaching | Missing event unsubscription (memory leak) |
| Expose settings via DependencyProperty | Use hardcoded values |
| Apply IsEnabled pattern | Always execute without condition |
| Check AssociatedObject for null | Use without null check |
npx claudepluginhub christian289/dotnet-with-claudecode --plugin wpf-dev-packImplements WPF XAML behaviors and triggers using Microsoft.Xaml.Behaviors.Wpf for code-behind-free interactivity, EventToCommand patterns, DataTriggers, and custom behaviors.
Provides behavioral guidelines to reduce common LLM coding mistakes, focusing on simplicity, surgical changes, assumption surfacing, and verifiable success criteria.
Searches, retrieves, and installs Agent Skills from prompts.chat registry using MCP tools like search_skills and get_skill. Activates for finding skills, browsing catalogs, or extending Claude.