Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/304.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/wpf/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 为什么尝试在WPF中使用行为时会出错?_C#_Wpf_Prism - Fatal编程技术网

C# 为什么尝试在WPF中使用行为时会出错?

C# 为什么尝试在WPF中使用行为时会出错?,c#,wpf,prism,C#,Wpf,Prism,我试图使用行为来处理WPF中按钮的单击事件 <Button Content="Another Button" Width="100" IsEnabled="True"> <i:Interaction.Triggers> ... </i:Interaction.Triggers> </Button> ... 但是,我收到以下错误消息: 在类型“Interaction”中找不到可附加属性“Trigge

我试图使用行为来处理WPF中按钮的单击事件

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

...
但是,我收到以下错误消息:

在类型“Interaction”中找不到可附加属性“Triggers”

这是我的命名空间,用于i:
xmlns:i=”http://schemas.microsoft.com/expression/2010/interactivity“

我还包括了
System.Windows.Interactivity
assembly。我认为这就是我使用行为所需要做的一切,但显然有些地方出了问题

这听起来像是一场灾难。如果您使用的是VS 2008,则可能会更正此问题(尽管有时在安装后我仍会遇到问题)


此行为已在Visual Studio 2010中更正。

对于Visual Studio 2010,您需要包含来自Expression Blend的以下3个引用:System.Windows.Interactive、Microsoft.Expression.Controls和Microsoft.Expression.Interactions

您正在使用哪个版本的visual studio?