Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Creating Arrow (Read 2353 times)
Sachin
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 85
Joined: Mar 14th, 2009
Creating Arrow
Apr 3rd, 2009 at 5:07pm
Print Post  
HI

in my application i am joining two nodes with arrows , in thos arrows looking 2D  we need more animation and silverlight effect while moving to another node need to show animation
is it possible in diagramlight ?
how to achive this one send example \

sachin
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Creating Arrow
Reply #1 - Apr 8th, 2009 at 7:31am
Print Post  
Hi,

You could create some Animation object and start or stop it in response to some event handlers:

Code
Select All
<d:Diagram x:Name="diagram"
	LinkCreated="diagram_LinkCreated"
	LinkModifying="diagram_LinkModifying"
	LinkModified="diagram_LinkModified">
</d:Diagram>



private SolidColorBrush brush;
private Color color;
private bool isStarted = false;
private Storyboard sb;

private void InitAnimation()
{
	brush = new SolidColorBrush(Colors.Green);

	sb = new Storyboard();
	ColorAnimation ca = new ColorAnimation();
	ca.From = Colors.Red;
	ca.To = Colors.Blue;
	ca.RepeatBehavior = RepeatBehavior.Forever;
	ca.Duration = new Duration(TimeSpan.FromMilliseconds(100));
	sb.Children.Add(ca);
	Storyboard.SetTarget(ca, brush);
	Storyboard.SetTargetProperty(ca, new PropertyPath("(SolidColorBrush.Color)"));
}

void diagram_LinkCreated(object sender, LinkEventArgs e)
{
	e.Link.Pen = new Pen(brush, 2, DashStyles.Solid);
}

void diagram_LinkModified(object sender, LinkEventArgs e)
{
	sb.Stop();
	isStarted = false;
}

void diagram_LinkModifying(object sender, LinkValidationEventArgs e)
{
	if (!isStarted)
	{
		isStarted = true;
		sb.Begin();
	}
}
 



I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint