Hi Stoyo,
have you tried with more than just one diagram item?
Here's a MainPage for you to see, first the XAML:
<UserControl x:Class="CancelDragTest.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:my="clr-namespace:MindFusion.Diagramming.Silverlight;assembly=MindFusion.Diagramming.Silverlight"
mc:Ignorable="d" d:DesignWidth="640" d:DesignHeight="480">
<Grid x:Name="LayoutRoot">
<my:Diagram
x:Name="diagramControl"
Behavior="Modify"
AllowInplaceEdit="False"
DefaultShape="Rectangle"
BackBrush="WhiteSmoke"
LinkHeadShape="Triangle"
LinkCrossings="Arcs" />
</Grid>
</UserControl>
then the code-behind:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using MindFusion.Diagramming.Silverlight;
namespace CancelDragTest
{
public partial class MainPage : UserControl
{
public MainPage()
{
InitializeComponent();
ShapeNode newNode = new ShapeNode(diagramControl);
newNode.Bounds = new Rect(0, 0, 100, 100);
ShapeNode destinationNode = new ShapeNode(diagramControl);
destinationNode.Bounds = new Rect(newNode.Bounds.Right + 100, newNode.Bounds.Bottom + 100, 200, 200);
diagramControl.Nodes.Add(newNode);
diagramControl.Nodes.Add(destinationNode);
DiagramLink connection = new DiagramLink(diagramControl);
connection.Origin = newNode;
connection.Destination = destinationNode;
diagramControl.Links.Add(connection);
diagramControl.NodeModifying += new NodeValidationEventHandler(diagramControl_NodeModifying);
diagramControl.LinkModifying += new LinkValidationEventHandler(diagramControl_LinkModifying);
}
void diagramControl_LinkModifying(object sender, LinkValidationEventArgs e)
{
e.CancelDrag();
}
void diagramControl_NodeModifying(object sender, NodeValidationEventArgs e)
{
e.CancelDrag();
}
}
}
I've done the following tests:
1. select _only_ the first node, the small one, and try to drag it somewhere, starting the dragging action from some point inside the node but not a selection handle. Result: the node cannot be moved, the link stays in place, too. So far so good...
2. select _only_ the first node, the small one, and tried to drag it somewhere, starting the dragging action from one of the election handles. Result: the node cannot be moved, the link tail _moves_.
3. select the small node and the link or, as you prefer, both the nodes then start dragging a node from _any_ point inside it. Result: the node moves, the link too.
Can you reproduce this behavior?
Cheers,
baba.