How apply a storyboard to a Label programmatically ?

Posted by ThitoO on Stack Overflow See other posts from Stack Overflow or by ThitoO
Published on 2010-03-25T18:18:35Z Indexed on 2010/03/25 18:53 UTC
Read the original article Hit count: 394

Filed under:
|
|

Hi :),

I've a little problem, I'd search google and my Wpf's books but I don't found any answer :(

I have created a little storyboard :

<Storyboard x:Key="whiteAnim" Duration="1">
        <ColorAnimation By="Black" To="White" Storyboard.TargetProperty="Background" x:Name="step1"/>
        <ColorAnimation By="White" To="Black" Storyboard.TargetProperty="Background" x:Name="step2"/>
</Storyboard>

This animation will change background color from black to white, and from white to black. I want to "apply" this storyboard to a Label :

Label label = new Label();
label.Content = "My label";

I'm looking for a method like "label.StartStoryboard(--myStoryboard--), do you have any ideas ?

Thank you :)

© Stack Overflow or respective owner

Related posts about c#

Related posts about wpf