Click here to Skip to main content
15,846,091 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;

Updated 19-Apr-13 11:40am
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