当我尝试向模板内的框架元素添加行为时出现此错误
最小示例:
xmlns:interact="http://schemas.microsoft.com/expression/2010/interactivity"
.....
<Style TargetType="Button">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Grid>
<interact:Interaction.Behaviors>
</interact:Interaction.Behaviors>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
Run Code Online (Sandbox Code Playgroud)
当我尝试运行应用程序时,我得到了
“无法设置未知成员 '{ http://schemas.microsoft.com/expression/2010/interactivity }Interaction.Behaviors'。”
请注意,仅当我在资源字典中定义此样式时才会发生这种情况。如果我将此样式剪切并粘贴到Window.Resources所有内容中,则效果很好。我怎样才能解决这个问题?