Animating a canvas?

Yes its me again - the guy with no real knowledge of WPF.

I have a canvas on my page and wish to make is so that when I click on it, it changes height (via a smooth animation). I can make it change height isntantly, but thats it....... any ideas?

This is what I have so far

void ChangeMidSize(object sender,RoutedEventArgs e)

{

MidSize.Height = 433;

}

Yerp, I am hopeless. I have tried looking at tutorials, but everything I have found is storyboard based or is designed to do a lot more than I am looking for... Please help!

Thanks guys!

[723 byte] By [mrmckeb] at [2007-12-24]
# 1

I am not sure if you are looking for a way to do it in XAML or CodeBehind

In XAML( this is one way)

<Canvas Width="100" Background="AliceBlue" Name="canvas1" Height="100">

<Canvas.Triggers>

<EventTrigger RoutedEvent="Canvas.MouseLeftButtonUp">

<EventTrigger.Actions>

<BeginStoryboard>

<Storyboard Storyboard.TargetProperty="Height">

<DoubleAnimation To="300" Duration="0:0:4"></DoubleAnimation>

</Storyboard>

</BeginStoryboard>

</EventTrigger.Actions>

</EventTrigger>

</Canvas.Triggers>

</Canvas>

leed at 2007-10-7 > top of Msdn Tech,Visual Studio Orcas,Windows Presentation Foundation (WPF)...
# 2
Thanks, that was very helpful.
mrmckeb at 2007-10-7 > top of Msdn Tech,Visual Studio Orcas,Windows Presentation Foundation (WPF)...

Visual Studio Orcas

Site Classified