2

在我的程序中,我有一个 System.Controls.Image,我想从这里添加一个摇动行为Animate Image in button to摇

我将 ShakingBehavior 复制到我的项目到它自己的类中,并且我已经有了 Blend SDK。

现在我将 XAML 部分添加到我的图像中

<Image Source="myImage.png" Grid.Row="{Binding Path=Row}" Grid.Column="{Binding Path=Col}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="0">

    <i:Interaction.Behaviors>
        <local:ShakeBehavior RepeatInterval="5" SpeedRatio="3.0"/>
    </i:Interaction.Behaviors>

</Image>

现在我得到一个我无法摆脱的错误!

(由于我这里没有英文 VS,所以我尝试翻译消息)

交互类型没有可附加的行为属性

可能只是一个要添加的命名空间(i 别名),但我无法将其用于工作

编辑 更多信息:图像包含在一个按钮中,该按钮位于数据模板内。

并且(充其量)我想在单击视图中的另一个按钮时开始动画。(此行为将有助于找到按钮作为提示)

4

1 回答 1

0

由于 Mohib 不想,我将发布我错过的正确行:

这个应该没有那些可以在 Mohibs 答案中找到的神奇的未打印值。

xmlns:i="clr-命名空间:System.Windows.Interactivity;assembly=System.Windows.Interactivity"

于 2012-07-06T19:26:19.710 回答