Click here to Skip to main content
15,886,518 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
In Win8 app I am trying animation height of ItemsControl. It worked through XAML with the help of this post, but when I tried through code it not happening. Am I missing something?
private static void AnimateSection(ItemsControl itemsControl, double fromHeight, double toHeight)
{
    var animate = new Storyboard ();
    var showHideContent = new DoubleAnimation { Duration = new Duration(TimeSpan.FromSeconds(1)) };

    showHideContent.From = fromHeight;
    showHideContent.To = toHeight;
    Storyboard.SetTarget(showHideContent, itemsControl);
    Storyboard.SetTargetProperty(showHideContent, "Height");
    Timeline.AllowDependentAnimations = true;
    animate.Children.Add(showHideContent);

    animate.Begin();
}
Posted
Updated 19-Apr-13 10:40am
v3
Comments
joshrduncan2012 19-Apr-13 17:03pm    
What does "Not happening" mean? Too vague.
Shashank Bisen 20-Apr-13 0:36am    
Mean to say that, the animation dosnt happens

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900