2012-11-12 6 views
2

XAML에서 애니메이션을 테스트하려고합니다. 나의 의도는 폰트 크기의 펄스를 만드는 것이 었습니다 (늘리거나 줄 이세요). 하지만 아래 코드를 입력하면 Visual studio에서 클래스 DoubleAnimation을 인식하지 못합니다. 내가 도대체 ​​뭘 잘못하고있는 겁니까?WPF XAML 애니메이션 (초보자)

<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> 

답변

5

당신은 Storyboard를 선언하고 부하시를 시작해야합니다

당신은 애니메이션 실행하기위한 Storyboard를 사용할 필요가
<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> 
+0

감사합니다. 스토리 보드에서 더 많은 내용을 읽어야 할 것 같습니다. – ragnarius

2

- 애니메이션이 링크를 따라에 대한 자세한 내용은

<TextBlock x:Name="textBlock" Text="HELLO"> 
    <TextBlock.Triggers> 
     <EventTrigger RoutedEvent="FrameworkElement.Loaded"> 
      <BeginStoryboard> 
       <Storyboard RepeatBehavior="Forever" AutoReverse="True"> 
        <DoubleAnimation Storyboard.TargetName="textBlock" 
           Storyboard.TargetProperty="FontSize" 
           From="10" To="30" 
           Duration="0:0:1"/> 
        </Storyboard> 
      </BeginStoryboard> 
      </EventTrigger> 
     </TextBlock.Triggers> 
</TextBlock> 

here.

+0

감사합니다. 스토리 보드에서 더 많이 읽어야합니다. – ragnarius