Mindmap sample: displaying connector handles

3 posts, 0 answers
  1. Robert
    Robert avatar
    17 posts
    Member since:
    Jun 2012

    Posted 09 Jul 2012 Link to this post

    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. Zarko
    Admin
    Zarko avatar
    755 posts

    Posted 11 Jul 2012 Link to this post

    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 >>

  3. UI for WPF is Visual Studio 2017 Ready
  4. Robert
    Robert avatar
    17 posts
    Member since:
    Jun 2012

    Posted 15 Jul 2012 Link to this post

    Hi zarko,

    Thanks for the heads up, binding the itemssource property did the trick.
    Much appreciated
    Robert
Back to Top