I am attempting to create my own template for an Expander
control. When the control is expanded, I want the content to slide down slowly.
The desired he
If you can use Interactions
with FluidLayout
(Blend 4 SDK) you are in luck, it's really useful for those fancy animation things.
First set the content CP's Height to 0:
To animate this, the Height
just needs to be animated to NaN
in the VisualState
that represents the expanded state (non-discrete animations would not let you use NaN
):
xmlns:is="http://schemas.microsoft.com/expression/2010/interactions"
That should be all that is necessary, the fluid layout will create the transition for you from there.
If you have a code-behind solution that would be fine, you can even use code-behind in dictionaries like this:
//TestDictionary.xaml.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
namespace Test
{
partial class TestDictionary : ResourceDictionary
{
//Handlers and such here
}
}