Layout Animation

Jun 18, 2009 at 4:52 PM

Is there anyway to change the layout animation?

The animation is doing odd things. It seems to animate from the old layout to the new layout, then it suddenly jumps back to the old layout and fades in to the new layout again.

I cant seem to find where the animation is defined, could you please point me to the file or explain how to override it.




Jun 18, 2009 at 7:19 PM
Edited Jun 18, 2009 at 7:19 PM

You can change the CreationTransition, MoveAnimation and DesctructionTransition properties of the GraphLayout control in order to change the animation behaviour.

To implement your own transition/animation just implement the GraphSharp.Controls.IAnimation and GraphSharp.Controls.ITransition interfaces. You can see some example for these implementations here:

Jan 13, 2012 at 4:26 PM

Here is how I solved this particular problem, given what palesz suggested.

I created two new subclasses of GraphSharp.Controls.FadeTransition, one for fading in and one for fading out:

public class FastFadeOutTransition : FadeTransition
	public FastFadeOutTransition()
		: base( 1.0, 0.0, 1 )


public class FastFadeInTransition : FadeTransition
	public FastFadeInTransition()
		: base( 0.0, 1.0, 1 )


Notice how they look similar to the existing FadeInTransition and FadeOutTransition classes in the GraphSharp.Controls source code. The added '1' in the constructor is what gets rid of the strange fading. If that's left blank, or set to anything greater than 1, that's when it freaks out.

Now we need to create instances of these classes in our XAML's resources section:

        <local:FastFadeInTransition x:Key="fastFadeInTransition" />
        <local:FastFadeOutTransition x:Key="fastFadeOutTransition" />

Finally, we need to tell XAML to use these transitions in our GraphLayout control:

    CreationTransition="{Binding Source={StaticResource fastFadeInTransition}}"
    DestructionTransition="{Binding Source={StaticResource fastFadeOutTransition}}" />
That's it! Try it out. It should hopefully look the way you expect it to. Otherwise, you can create your own transition classes as palesz said.

Jan 13, 2012 at 4:26 PM
Edited Jan 13, 2012 at 4:27 PM

[Accidentally double-posted]