locked
New to Blend - 2 Animation Questions RRS feed

  • Question

  • I just started playing with Blend and had a couple of questions.  I have a stack panel with 2 grids inside of it.  I have animated the top grid to shrink vertically.  I was hoping that when it shrank the grid beneath it would slide up but it's not doing that.  Is there a trick to get something like this to work?  Essentially the top grid animates to a height of 0 so the 2nd grid should slide up and take it's place.

    2nd, is there a way to save an animation to reuse over and over?  So if I want to reuse this shrinking animation on a number of grids I can do that without having to create an animation for each one separately?  Thanks.
    Thursday, August 14, 2008 3:49 PM

All replies

  • Can anyone provide some insight here?  Thanks.
    Wednesday, August 20, 2008 3:57 PM
  • Hey there,

    So your method of shrinking the grid should work inside of the stack panel. Please post your markup here so it can be looked at to see what is not working correctly.

    To your other question, a storyboard is specific to the elements whos properties you modify as set in the XAML, so directly in Blend, no you can not (at the moment) apply a generic animation to a group of elements as such. You can do this in code though which is more complex, but you essentially expose the animation targets through properties that you can modify at runtime.

    Cheers

    Expression MVP

    Learn Expression Blend at learnexpressionstudio.com

    my blog : http://x-coders.com/blogs/sneaky/default.aspx

    Thursday, August 21, 2008 5:02 PM
    Moderator
  • Hi gswartz,


    For your first question, I have tried it and it definitely works, all I did was reduce the height of the 1st grid that is placed on top and the 2nd grid will automatically slide to its place. Do try testing it out in a new project, and if it still doesn't work, try make sure the margins of your 2 grids is not 0, and the height and width of your grids are not set to auto.

    For your 2nd question, there is definitely a way to do that, all you need to do is create that animated grid within a user control, and then use it repeatedly. You could also check out this tutorial at MSDN on creating WPF User Controls

    -
    Monday, August 25, 2008 6:29 AM