2
這是我第一次創建銀色動畫。過去幾天我一直在努力創建一個簡單的動畫,但我無法使它工作。我無法相信爲什麼這麼難。銀色動畫不能正常工作
的XAML:
<UserControl x:Class="BuzzLifeAppsSilverlight.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="400">
<UserControl.Resources>
<Storyboard x:Name="Storyboard1" AutoReverse="True" RepeatBehavior="Forever" BeginTime="1">
<DoubleAnimation Duration="0:0:2" To="-332" Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.TranslateX)" Storyboard.TargetName="button1" d:IsOptimized="True"/>
<DoubleAnimation Duration="0:0:2" To="-12" Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.TranslateY)" Storyboard.TargetName="button1" d:IsOptimized="True"/>
</Storyboard>
</UserControl.Resources>
<Canvas x:Name="LayoutRoot" Background="White">
<Button Canvas.Left="235" Canvas.Top="136" Content="Button" Height="23" Name="button1" Width="75" RenderTransformOrigin="0.5,0.5" >
<Button.RenderTransform>
<CompositeTransform/>
</Button.RenderTransform>
</Button>
</Canvas>
</UserControl>
代碼:
public MainPage()
{
InitializeComponent();
Storyboard1.Begin();
}
請將您的故事板(Storyboard1)的XAML聲明! – Jehof
對不起,我發佈時沒有看到它。它在那裏,但隱藏 – gangt