Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why do I get an error trying to use Behaviors in WPF?

Tags:

c#

wpf

prism

I am trying to use Behaviors to handle the click event of a button in WPF.

<Button Content="Another Button" Width="100" IsEnabled="True">
    <i:Interaction.Triggers>        
       ...
    </i:Interaction.Triggers>
</Button>

However I am getting this error message:

The attachable property 'Triggers' was not found in type 'Interaction'

Here is my namespace for i: xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"

And I have included the System.Windows.Interactivity assembly. I presumed that was all that I need to do to use behaviors but obviously something is going wrong.

like image 417
Jim_CS Avatar asked Sep 15 '25 05:09

Jim_CS


1 Answers

For Visual Studio 2010 you need to include these 3 references from Expression Blend: System.Windows.Interactivity, Microsoft.Expression.Controls and Microsoft.Expression.Interactions.

like image 91
Bill W Avatar answered Sep 17 '25 20:09

Bill W