I have a datatemplate where I need node’s both linkableto and linkablefrom to be true and as something is linked to this node a dynamic port is created in it for the link.
All works fine but I am not able to move the node, every time I try to move the node it starts a link from it. here is the dataTemplate
<br /> <DataTemplate x:Key="SelectionAdornmentTemplate">
<br /> <go:SelectionHandle Stroke="{x:Static SystemColors.HighlightBrush}" StrokeThickness="4" go:Part.Selectable="False"/>
<br /> </DataTemplate>
<br />
<br /> <DataTemplate x:Key="ResizeAdornmentTemplate">
<br /> <go:SpotPanel>
<br /> <go:ToolHandle go:SpotPanel.Spot="0.0 0.5"
<br /> go:NodePanel.Figure="Rectangle" Width="6" Height="6"
<br /> Fill="Fuchsia" Stroke="Black" StrokeThickness="1" />
<br /> <go:ToolHandle go:SpotPanel.Spot="1.0 0.5"
<br /> go:NodePanel.Figure="Rectangle" Width="6" Height="6"
<br /> Fill="Fuchsia" Stroke="Black" StrokeThickness="1" />
<br /> </go:SpotPanel>
<br /> </DataTemplate>
<br /> <!-- ===================================Actual Template=================================== -->
<br /> <DataTemplate x:Key="BarNode">
<br /> <ItemsControl go:Part.SelectionAdorned="True"
<br /> go:Part.Resizable="True"
<br /> go:Part.ResizeAdornmentTemplate="{StaticResource ResizeAdornmentTemplate}"
<br /> go:Part.SelectionAdornmentTemplate="{StaticResource SelectionAdornmentTemplate}"
<br /> go:Part.SelectionElementName="Bar"
<br /> go:Node.Location="{Binding Path=Data.Location, Mode=TwoWay}"
<br /> go:Node.LinkableFrom="True" go:Node.LinkableTo="True"
<br /> go:Node.FromSpot="BottomSide" go:Node.ToSpot="TopSide">
<br /> <ItemsControl.ItemsPanel>
<br /> <ItemsPanelTemplate>
<br /> <Canvas x:Name="Bar" Background="Black" Height="8" Width="120"/>
<br /> </ItemsPanelTemplate>
<br /> </ItemsControl.ItemsPanel>
<br /> </ItemsControl>
<br /> </DataTemplate>
<br /> <!-- ===================================Actual Template=================================== -->
<br />
Any idea how I can move this node?
If you set go:Node.LinkableFrom=“True” or go:Node.LinkableTo=“True” on the root element of the Node, that means that every element can start a linking operation.
However, you can choose which elements not to support starting drawing a new link by setting those properties to “False”.
Thanks Walter, that solved the problem I have moved ItemsControl into a border (with a reasonable thickness) and have set Linkable properties of the Canvas to false, Now I can move the node if I grab it by canvas and link it if I grab it by the border