Hi Walter,
I just tried your code, but replacing your call to “Execute” with generating a trace message. I also declared the event handler as follows:
…
<Path-or-go:LinkShape … MouseLeftButtonDown=“Path_MouseLeftButtonDown” />
…
Everything worked fine, as one would expect. I tried this in both Silverlight 4 and in WPF 4.
So I’m curious what’s different about your situation.
Is there a reason you are declaring the event handler on the Path or go:LinkShape instead of on the root element of the link’s DataTemplate?
Might the link be thin, and the second click is happening “off” of the link shape, thereby never resulting in a second call to the event handler?
It has to do with Part.Selectable, because if Part.Selectable is false it works fine (even on single pixel paths ). I did try it on the LinkPanel itself in the data template and got the same result.
The Links I tested before were Selectable.
This time I have simply modified the FlowChart sample.
Here’s the updated Link DataTemplate:
<DataTemplate x:Key="LinkTemplate">
<go:LinkPanel go:Part.Reshapable="True">
<go:Link.Route>
<go:Route Routing="AvoidsNodes" Curve="JumpOver" Curviness="10"
RelinkableFrom="True" RelinkableTo="True" />
</go:Link.Route>
<Path Fill="Black" go:LinkPanel.ToArrow="Standard" />
<Path go:LinkPanel.IsLinkShape="True" Stroke="Black" StrokeThickness="2"
<font color="#ff0000">MouseLeftButtonDown="LinkShape_MouseLeftButtonDown"</font> />
<!-- this is the label that is only shown when connected to a Decision node -->
<TextBlock Text="{Binding Path=Data.Text, Mode=TwoWay}"
TextWrapping="Wrap" MaxWidth="50" go:Part.TextEditable="True"
go:LinkPanel.Index="1" go:LinkPanel.Alignment="0 0 -2 0"
Visibility="{Binding Path=Link,
Converter={StaticResource theLabelVisibilityConverter}}" />
</go:LinkPanel>
</DataTemplate>
Here’s the event handler:
private void LinkShape_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) {
if (DiagramPanel.IsDoubleClick(e)) {
var link = Part.FindAncestor<Link>(sender as UIElement);
if (link != null && link.Data != null) {
e.Handled = true;
System.Diagnostics.Debug.WriteLine("LinkShape_MouseLeftButtonDown " + link.ToString());
}
}
}
Double-click is working as expected for me. This is in v1.2, using Silverlight 3.