I'm having this problem that i can't figure out.
So the situation is this, i have a node (n1) that has 1 inbound connection point and a few outbound connection points.
I drag a connection from a different node (n2) into the inbound connection point of n1's inbound connection point - all n1's OUTbound connection points get hidden(!) and i have no idea how to stop it from happening. I need all connection points to show on the node (n1 but all other nodes as well) no matter if the user can drag a connection into them or not.
Something in the code is hiding all the inbound connection points when a new connection is dragged over a a certain node.
I am unable to figure it out, my thumb template was reduced to minimum, it is almost naked, there are no triggers there that hide it.
I snooped it as well - and it says it is visible, i can't even figure out how come all visibilities up in the visual tree are Visible but the connection point is not visible on the screen.
I went over all XAML code of the node template and nothing can explain why all outbound connection points is disappearing while a new connection is dragged over a node.
Something so simple gone so complicated. It should have been one line of code.
I am lost. I need HELP!
This is my thumb style:
<DataTemplate x:Key="DefaultConnectionPointTemplate" x:Shared="True">
<Viewbox Margin="-4,-4,4,4" Width="12" Height="12">
<Image Source="Images/Port.png"/>
</Viewbox>
</DataTemplate>
<Style x:Key="ConnectionPointThumbStyle" TargetType="{x:Type ms:ConnectionPointThumb}">
<Setter Property="Visibility" Value="Visible"></Setter>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ms:ConnectionPointThumb">
<Canvas VerticalAlignment="Top" HorizontalAlignment="Left">
<ContentPresenter Name="ContentPresenter" Content="{Binding}"
ContentTemplate="{StaticResource DefaultConnectionPointTemplate}"
VerticalAlignment="Center" HorizontalAlignment="Center" />
</Canvas>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
This is my node element style:
<ControlTemplate x:Key="FullDiagramNodeTemplate" TargetType="{x:Type ms:DiagramNodeElement}">
<Grid>
<Grid Canvas.Left="{TemplateBinding Left}" Canvas.Top="{TemplateBinding Top}" RenderTransformOrigin="0.5,0.5">
<Grid.RenderTransform>
<RotateTransform Angle="{Binding Node.Rotation, RelativeSource={RelativeSource TemplatedParent}}" />
</Grid.RenderTransform>
<ms:MoveThumb Name="Mover" Element="{Binding RelativeSource={RelativeSource TemplatedParent}}" Geometry="{TemplateBinding Geometry}" />
<ms:Resizer Element="{Binding RelativeSource={RelativeSource TemplatedParent}}" Name="Resizer" />
<ContentPresenter Name="Presenter" ContentTemplate="{Binding NodeTemplate, RelativeSource={RelativeSource TemplatedParent}}" />
<ms:RotateThumb Name="Rotater" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="-20,-20,0,0"
Element="{Binding RelativeSource={RelativeSource TemplatedParent}}" />
<ms:ConnectionPointThumb ConnectionPoint="{Binding Content.DefaultConnectionPoint, RelativeSource={RelativeSource TemplatedParent}}"
Width="{Binding ActualWidth, RelativeSource={RelativeSource TemplatedParent}}"
Height="{Binding ActualHeight, RelativeSource={RelativeSource TemplatedParent}}"
IsHitTestVisible="False" Focusable="True" Visibility="Collapsed"
Name="Connector" Style="{StaticResource {x:Static ms:MoveThumb.InvisibleStyleKey}}" />
<Grid.ContextMenu>
<ContextMenu>
<ContextMenu.Items>
<MenuItem Header="Show Bounds" Click="OnShowBounds"></MenuItem>
<MenuItem Header="Calculate Center XY" Click="OnCalculateCenterXyForNode"></MenuItem>
<MenuItem Header="Fit to Center" Click="OnForToCenter"></MenuItem>
</ContextMenu.Items>
</ContextMenu>
</Grid.ContextMenu>
</Grid>
<ItemsControl ItemsSource="{Binding Content.ConnectionPoints, RelativeSource={RelativeSource TemplatedParent}}"
ItemTemplate="{StaticResource ConnectionPointThumbTemplate}"
Name="Connectors">
<ItemsControl.RenderTransform>
<TranslateTransform X="{Binding Left, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource Negative}}"
Y="{Binding Top, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource Negative}}" />
</ItemsControl.RenderTransform>
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<Canvas />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemContainerStyle>
<Style>
<Setter Property="Canvas.Left">
<Setter.Value>
<MultiBinding Converter="{StaticResource CPX}">
<Binding />
<Binding Path="Formatter.Layout" RelativeSource="{RelativeSource AncestorType={x:Type ms:DiagramSurface}}" />
<Binding Path="Position" />
</MultiBinding>
</Setter.Value>
</Setter>
<Setter Property="Canvas.Top">
<Setter.Value>
<MultiBinding Converter="{StaticResource CPY}">
<Binding />
<Binding Path="Formatter.Layout" RelativeSource="{RelativeSource AncestorType={x:Type ms:DiagramSurface}}" />
<Binding Path="Position" />
</MultiBinding>
</Setter.Value>
</Setter>
</Style>
</ItemsControl.ItemContainerStyle>
</ItemsControl>
</Grid>
</ControlTemplate>