Context menu issue

Hi,


I have a problem with showing the context menu of a group when
clicking right click inside the group because I added a transparent rectangle
to the Link template so when I drag a node it will be easy to drop it on the
link.

When I press on the transparent rectangle it showing the context menu of
the link.

Is there a way that will allow to drop a node during the drag on the link easy but when I am not during a drag operation the link won’t take much space so when I am click next to it, we will show the group(which contain the link) context menu?

my link template:

<go:LinkPanel x:Uid="go:LinkPanel_1" go:Part.Reshapable="False" go:Node.Movable="False" go:Node.Copyable="False"

go:Node.LayerName="Foreground"

go:Part.Selectable="{Binding Path=Data.FlowCanvasViewModel.IsFlowLinkSelectable}">

<go:Route x:Uid="go:Route_1" Routing="Orthogonal" Curve="None" Corner="5"

FromSpot="BottomCenter" ToSpot="TopCenter"

RelinkableFrom="False" RelinkableTo="False"

ToShortLength="5" FromShortLength="5"/>

<Border x:Uid="dropZoneIndication" x:Name="dropZoneIndication" Background="Transparent" CornerRadius="3"

Width="70" Height="15" BorderThickness="2"/>

<Path x:Uid="arrowPath" x:Name="arrowPath" Fill="{DynamicResource FlowLinkBrush}"

go:LinkPanel.ToArrow="Standard" go:LinkPanel.ToArrowScale="1"

go:LinkPanel.Offset="0,-0.5" />

The common thing to do is to use a second LinkShape in the LinkPanel, one that has a thick Transparent stroke. That will make the link act thicker but still appear thin. Several of the samples use this technique to make links easier to select or drop-onto.

Just replace that fixed-size Border with a second LinkShape.

Using LinkShape gave me the same result as my transparent rectangle.

I wanted that when I drop a node on the link it will be easy but when right clicking next to the link (on the transparent rectangle) it will not select the link and it will show the group(that contain the link) context menu.

I thought about using a trigger that will set the Width of the transparent rectangle during the drag so by default it will have a width of 20 and during the drag with a trigger I will set the width to 200 but I have a problem doing it.

The DoStart and DoStop functions in the dragging tool only being called when I am dragging an existing node but if I drag a new node from outside the canvas they aren’t being called so I can’t change the property that I wanted the trigger will bind to.

Do you have any ideas?

Thanks

I think overriding DraggingTool.DoActivate (before calling the base method) and DoDeactivate would be sensible.

For external (WPF) drag-and-drops, override DraggingTool.DoDragEnter and DoDragLeave.

I thought about a better solution.

I removed the transparent rectangle and instead I change the dragging tool to locate the link with a offset rectangle I made by the mouse location point intead of only using the mouse location point.

That way it is easy to drop the node on the link and the link don’t take that much space