NodePanel and moving/creating links

Hi,

I have the following node template (see below). My Problem now is that when I click&drag in the node, sometimes I can move the node and other times a link creation is started.

For me, it is not clear why once I can move the node and on another time a link is started, i.e. for me, the behaviour is not predictable. I already tried different spots in the node but still, I cannot see a strategy behind the behaviour I experience.

Any idea?

Thanks,
Marc

<DataTemplate x:Key="NewNodeTemplate">
	<go:NodePanel go:Node.FromSpot="Center"
				  go:Node.ToSpot="Center"
				  go:Node.Location="{Binding Path=Data.Location, Mode=TwoWay}"
				  Background="{Binding Path=Node.IsSelected, Converter={StaticResource theSelectedBrushConverter}}">
		<Border BorderThickness="1" Padding="5,0,5,0" CornerRadius="3"
				go:Node.LinkableFrom="True" 
				go:Node.LinkableTo="True"
				go:Node.PortId="">
			<Border.BorderBrush>
				<VisualBrush>
					<VisualBrush.Visual>
						<Rectangle StrokeDashArray="6.0 3.0"
								   Stroke="DarkBlue"
								   StrokeThickness="1"
								   RadiusX="{Binding RelativeSource={RelativeSource AncestorType={x:Type Border}}, Path=CornerRadius.TopRight}"
								   RadiusY="{Binding RelativeSource={RelativeSource AncestorType={x:Type Border}}, Path=CornerRadius.BottomLeft}"
								   Width="{Binding RelativeSource={RelativeSource AncestorType={x:Type Border}}, Path=ActualWidth}"
								   Height="{Binding RelativeSource={RelativeSource AncestorType={x:Type Border}}, Path=ActualHeight}"/>
					</VisualBrush.Visual>
				</VisualBrush>
			</Border.BorderBrush>
			<StackPanel MinWidth="100" 
						Width="150" 
						MinHeight="50"
						Name="GoStackPanel">
				<Grid>
					<Grid.ColumnDefinitions>
						<ColumnDefinition Width="*"/>
						<ColumnDefinition Width="Auto"/>
					</Grid.ColumnDefinitions>
					<TextBlock Grid.Column="0" Grid.ColumnSpan="2" FontSize="11" FontWeight="Bold" Text="{Binding Data.Label}" TextAlignment="Center" VerticalAlignment="Center"/>
					<Image Grid.Column="1" HorizontalAlignment="Right" Width="20" Height="20" 
						   Visibility="{Binding Path=Data.IsCommissioningRelated, Converter={StaticResource BooleanToVisibilityConverter}}">
						<Image.Source>
							<BitmapImage UriSource="/MasterData/Workflow/Designer/Resources/shoppingcart.ico"/>
						</Image.Source>
					</Image>
				</Grid>
				<TextBlock FontSize="11" FontWeight="Bold" Text="{Binding Data.DescriptionWorkcentertype}" TextAlignment="Center" />
				<Expander IsExpanded="{Binding Data.IsExpanded}" 
						  Visibility="{Binding Path=Data.HasStwsAssignments, Converter={StaticResource BooleanToVisibilityConverter}}">
					<ListView ItemsSource="{Binding Data.WsdeStwsAssignments}">
						<ListView.ItemTemplate>
							<DataTemplate>
								<TextBlock FontSize="10" Text="{Binding Label}"/>
							</DataTemplate>
						</ListView.ItemTemplate>
					</ListView>
				</Expander>
			</StackPanel>
		</Border>
	</go:NodePanel>
</DataTemplate>

I think what’s happening is that the “port” element (the Border) is surrounding and behind the text and image. Sometimes the mouse event is on the text or image, sometimes it gets to the Border.

Maybe you should have a “Transparent” Background on the StackPanel, so that mouse events will be caught everywhere within the StackPanel.