Hello,
This should be an easy one to someone who is familiar with animations in C# and WPF. I have a grid panel defined in WPF which contains an ink canvas and some buttons. This gives me the layout I want for this control - but I would like to slide it on and off the screen when the user needs it, using the code behind file to control it from another button. I can't animate the grid because it doesn't have a margin or center dependency property. What should I do?
Many Thanks,
Ricky

Update:
okay so I've managed to figure out that I'll need to add a custom DependencyProperty and then animate that. The margin property with then be update by Binding with the DP.
So far I've got:
CODE
<Grid x:Name="dschg_uc" Margin="{Binding Margindp}" >
in the XAML
and:
CODE
public class Test : Animatable
{
public static readonly DependencyProperty MyDoubleProperty = DependencyProperty.Register("Margindp", typeof(double), typeof(SurfaceWindow1));
public double Margindp
{
get
{
return (double)GetValue(MyDoubleProperty);
}
set
{
SetValue(MyDoubleProperty, value);
}
}
protected override Freezable CreateInstanceCore()
{
throw new NotImplementedException();
}
dschg_uc.BeginAnimation(Test.MyDoubleProperty, positionAnimation);
in the code.
I know it's not right (because it's not working). What have I done wrong?
Update2: I managed to get what I want by wrapping the grid in a user control which does have a margin dependency property and using a thicknessanimation. And I learned some things about DPs and binding along the way.
Thanks!
This post has been edited by chipshop: 1 Jul, 2009 - 02:57 PM