No connectors is showing

3 posts, 0 answers
  1. Mattias
    Mattias avatar
    15 posts
    Member since:
    May 2011

    Posted 04 Apr 2012 Link to this post

    public class PrimitiveShape : RadDiagramShapeBase
    {
        public PrimitiveShape() : base()
        {
            this.DefaultStyleKey = typeof(PrimitiveShape);
             
        }
    }
    <ResourceDictionary
        xmlns:local="clr-namespace:GSAB.RSProduction.Modules.OfficeTools.ViewModel.Workflow">
     
        <Style TargetType="local:PrimitiveShape">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="local:PrimitiveShape">
                        <Border Background="{TemplateBinding Background}"
                                BorderBrush="{TemplateBinding BorderBrush}"
                                BorderThickness="{TemplateBinding BorderThickness}">
                             
                            <telerik:RadDiagramShape Geometry="{telerik:CommonShape ShapeType=OctagonShape}" />
                         
                        </Border>
     
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
    </ResourceDictionary>
    I'm trying to implement a simple primitive shape by inheriting from RadDiagramShapeBase, but when adding it to the diagram no connectors is showing. Any suggestions on what I'm doing wrong here would be appreciated.
  2. Mattias
    Mattias avatar
    15 posts
    Member since:
    May 2011

    Posted 04 Apr 2012 Link to this post

    Fount it, added the following part from the theme to my controltemplate:

    <ItemsControl x:Name="ConnectorsAdorner"
                                       ItemsSource="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=ConnectorPoints}"
                                       Visibility="Collapsed"
                        >
                               <ItemsControl.ItemsPanel>
                                   <ItemsPanelTemplate>
                                       <primitives:ConnectorsPanel />
                                   </ItemsPanelTemplate>
                               </ItemsControl.ItemsPanel>
                           </ItemsControl>
  3. DevCraft banner
  4. Alex Fidanov
    Admin
    Alex Fidanov avatar
    636 posts

    Posted 05 Apr 2012 Link to this post

    Hi,

     Could you please give us more information on what you are trying to achieve? Are you inheriting the base RadDiagramShape class to extend its funcionality or to have a different look and feel? If it is the latter, then you can just change the default template or content template, without subclassing it. Moreover, in the inherited shape's template you should not be using the original shape. I would recommend using the default shape style as a base for your custom one. The default styles we are shipping in the installation directory. Its full path should look something like this : C:\Program Files (x86)\Telerik\RadControls for Silverlight Q1 2012\Themes\Metro\Themes\Metro\DiagramShapes.xaml

    All the best,
    Alex Fidanov
    the Telerik team

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

Back to Top