WPF XAML Animation (Newbie)
animation, wpf, xaml
Solution
You need to declare a `Storyboard` and start it upon load:
<TextBlock x:Name="Text" Text="Hello!!">
<TextBlock.Triggers>
<EventTrigger RoutedEvent="FrameworkElement.Loaded">
<EventTrigger.Actions>
<BeginStoryboard>
<Storyboard Duration="00:00:01" RepeatBehavior="Forever" AutoReverse="True">
<DoubleAnimation From="10" To="20" Storyboard.TargetName="Text" Storyboard.TargetProperty="FontSize"/>
</Storyboard>
</BeginStoryboard>
</EventTrigger.Actions>
</EventTrigger>
</TextBlock.Triggers>
</TextBlock>
Problem
I am trying to test animation in XAML. My intension was to make a font-size pulse (increase and decrease forever). But when I type in the code below, Visual studio does not recognize the class `DoubleAnimation`. What am I doing wrong? ``` <Window x:Class="testingAnimation.MainWindow" xmlns="http://schemas.microsoft.com/netfx/2007/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MainWindow" Height="350" Width="525"> <StackPanel> <TextBlock Text="HELLO"> <TextBlock.FontSize> <DoubleAnimation /> </TextBlock.FontSize> </TextBlock> </StackPanel> </Window> ```