1
我想在XAML中製作同時生長和旋轉的標籤。 爲什麼我的代碼不工作? (文長,但不轉動)xaml旋轉並生長標籤動畫
<Window
xmlns = "http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x = "http://schemas.microsoft.com/winfx/2006/xaml"
Title = "Animation"
Height = "600" Width = "1000" WindowStartupLocation="CenterScreen">
<Window.Resources>
<Storyboard x:Key="Storyboard">
<DoubleAnimation
Storyboard.TargetProperty="FontSize"
From = "12" To = "200" Duration = "0:0:4"
RepeatBehavior = "Forever" AutoReverse="True"/>
<DoubleAnimation
Storyboard.TargetProperty="(UIElement.RenderTransform).(RotateTransform.Angle)"
From="0" To="360" Duration="0:0:4"
RepeatBehavior="Forever"/>
</Storyboard>
</Window.Resources>
<Label x:Name="myLabel" Content = "Some text">
<Label.Triggers>
<EventTrigger RoutedEvent="Label.Loaded">
<EventTrigger.Actions>
<BeginStoryboard Storyboard="{StaticResource Storyboard}"/>
</EventTrigger.Actions>
</EventTrigger>
</Label.Triggers>
</Label>
</Window>
爲什麼TransformGroup?僅僅因爲Blend創造了它?你的例子會更簡單,因此沒有它會更好。 – Clemens
感謝您注意並報告@Clemens。樣品已更新! – AirL