我正在尝试在Windows 10 UWP应用上使用Xaml中的以下代码在按钮上创建动画:
<Button x:Name="EoIdButton" Grid.Row="0" Grid.Column="2" Margin="0,0,0,0" view:EventHandlers.Attach="Click" BorderBrush="DarkGray" FontFamily="Segoe MDL2 Assets" Content="{Binding EoIdButtonContent, Mode=TwoWay, Converter={StaticResource SegoeConverter}}" Style="{StaticResource CircleButtonStyle}" Visibility="{Binding EoVis, Mode=TwoWay, Converter={StaticResource BooleanToVisibilityConverter}}" HorizontalAlignment="Center" VerticalAlignment="Center">
<Button.Triggers>
<EventTrigger RoutedEvent="Button.Click">
<BeginStoryboard>
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="EoIdButton" Storyboard.TargetProperty="Margin">
<DiscreteObjectKeyFrame KeyTime="0:0:3" Value="0,0,40,0"/>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</Button.Triggers>
</Button>
我收到标题中提到的错误,并且EventTrigger行的.Click
部分带有下划线蓝色并显示错误。当我尝试运行它时,它会中断。我尝试在按钮上添加一个普通的Click事件,它不会改变任何东西。我有自己的点击处理程序,我附加到我的视图模型,所以我想也许它只需要处理程序后面的普通代码,我想我错了。我一定错过了别的什么?