using-wpf-behaviors-triggers

Solid

Implements XAML behaviors and triggers using Microsoft.Xaml.Behaviors.Wpf. Use when adding interactivity to XAML without code-behind, implementing EventToCommand patterns, or creating reusable behaviors.

Data & Documents 40 stars 6 forks Updated 6 days ago MIT

Install

View on GitHub

Quality Score: 78/100

Stars 20%
54
Recency 20%
100
Frontmatter 20%
40
Documentation 15%
100
Issue Health 10%
80
License 10%
100
Description 5%
100

Skill Content

# WPF Behaviors and Triggers ## 1. Setup ### 1.1 Install NuGet Package ```xml <PackageReference Include="Microsoft.Xaml.Behaviors.Wpf" Version="1.1.*" /> ``` ### 1.2 XAML Namespace ```xml <Window xmlns:b="http://schemas.microsoft.com/xaml/behaviors"> ``` --- ## 2. EventTrigger Executes actions when events occur. ### 2.1 InvokeCommandAction (MVVM Recommended) ```xml <Button Content="Click Me"> <b:Interaction.Triggers> <b:EventTrigger EventName="Click"> <b:InvokeCommandAction Command="{Binding ClickCommand}"/> </b:EventTrigger> </b:Interaction.Triggers> </Button> ``` ### 2.2 With Event Args ```xml <ListBox> <b:Interaction.Triggers> <b:EventTrigger EventName="SelectionChanged"> <b:InvokeCommandAction Command="{Binding SelectionChangedCommand}" PassEventArgsToCommand="True"/> </b:EventTrigger> </b:Interaction.Triggers> </ListBox> ``` ### 2.3 ChangePropertyAction ```xml <Button Content="Toggle Visibility"> <b:Interaction.Triggers> <b:EventTrigger EventName="Click"> <b:ChangePropertyAction TargetName="MyPanel" PropertyName="Visibility" Value="Collapsed"/> </b:EventTrigger> </b:Interaction.Triggers> </Button> <StackPanel x:Name="MyPanel"/> ``` --- ## 3. DataTrigger Executes actions based on data conditions. ```xml <TextBlock Text="{Binding Status}"> ...

Details

Author
christian289
Repository
christian289/dotnet-with-claudecode
Created
7 months ago
Last Updated
6 days ago
Language
C#
License
MIT

Similar Skills

Semantically similar based on skill content — not just same category