This is a migrated thread and some comments may be shown as answers.

Mindmap sample: displaying connector handles

2 Answers 102 Views
Diagram
This is a migrated thread and some comments may be shown as answers.
Robert
Top achievements
Rank 1
Robert asked on 09 Jul 2012, 08:02 PM
Hi

I am playing with mindmap sample provided with Q2 2012 release and I am trying to display the connectors handles around the mindmap shapes. I tough that I would only had to add the corresponding VisualState as well as the ConnectorsControl on the shape template to get the connection adorner to display the connector anchors around the shapes but I can't get the diagram to show them when I hover a shape with a connection start.

Here is the visual state  I added as well as the corresponding ConnectorsControl I added to the mindmap shape template:
<VisualStateGroup x:Name="ConnectorsAdornerVisibilityStates">
         <VisualState x:Name="ConnectorsAdornerCollapsed"/>
         <VisualState x:Name="ConnectorsAdornerVisible">
          <Storyboard>
           <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetProperty="Visibility" Storyboard.TargetName="ConnectorsControl">
            <DiscreteObjectKeyFrame KeyTime="0">
             <DiscreteObjectKeyFrame.Value>
              <Visibility>Visible</Visibility>
             </DiscreteObjectKeyFrame.Value>
            </DiscreteObjectKeyFrame>
           </ObjectAnimationUsingKeyFrames>
          </Storyboard>
         </VisualState>
        </VisualStateGroup>
...
<Telerik_Windows_Controls_Diagrams_Primitives:ConnectorsControl x:Name="ConnectorsControl" ItemContainerStyle="{TemplateBinding ConnectorStyle}" Visibility="Visible"/>

Anyone could share a pointer on how to display those connectors on the mindmap shapes?

Rgds

2 Answers, 1 is accepted

Sort by
0
Zarko
Telerik team
answered on 11 Jul 2012, 04:21 PM
Hello Robert,
As far as I could see the VisualStates look ok, so I guess the problem is that you haven't bound the ItemsSource of the ConnectorsControl:
<VisualStateGroup x:Name="ConnectorsAdornerVisibilityStates">
    <VisualState x:Name="ConnectorsAdornerCollapsed" />
    <VisualState x:Name="ConnectorsAdornerVisible">
        <Storyboard>
            <ObjectAnimationUsingKeyFrames Duration="0"
                    Storyboard.TargetName="ConnectorsControl"
                    Storyboard.TargetProperty="Visibility">
                    <DiscreteObjectKeyFrame KeyTime="0">
                    <DiscreteObjectKeyFrame.Value>
                        <Visibility>Visible</Visibility>
                    </DiscreteObjectKeyFrame.Value>
                </DiscreteObjectKeyFrame>
            </ObjectAnimationUsingKeyFrames>
        </Storyboard>
    </VisualState>
</VisualStateGroup>
(this looks ok)
<primitives:ConnectorsControl x:Name="ConnectorsControl"
                ItemsSource="{TemplateBinding Connectors}" Visibility="Collapsed"
                ItemContainerStyle="{TemplateBinding ConnectorStyle}" />
(you should add the ItemsSource binding to your code)
Also, please note that we are setting the UseDefaultConnectors property of the shapes to False(this means that you won't see the default 5 connectors but only the ones we manually add in the shapes constructors) so you may want to change that.
Could you please try this changes and if you have further questions feel free to ask.

Regards,
Zarko
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Robert
Top achievements
Rank 1
answered on 15 Jul 2012, 05:42 PM
Hi zarko,

Thanks for the heads up, binding the itemssource property did the trick.
Much appreciated
Robert
Tags
Diagram
Asked by
Robert
Top achievements
Rank 1
Answers by
Zarko
Telerik team
Robert
Top achievements
Rank 1
Share this question
or