We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Control Template for 'syncfusion:Node'

Thread ID:

Created:

Updated:

Platform:

Replies:

128490 Jan 25,2017 09:36 AM Jan 27,2017 03:32 AM WPF 3
loading
Tags: Diagram
Srikanth
Asked On January 25, 2017 09:36 AM

HI,

I have a unique requirement to render ports from data template dynamically, so I was trying to create a custom controltemplate for node as following..

It is rendering properly. However, throwing an exception "System.ArgumentNullException" when I move mouse over the node. 

It appears that the exception was coming from 'DragProvider' component, but does not give any details. 

Can you please help me understand what to done in order to create a 'controltemplate' for node ?

I have attached my sample project below.

<Style TargetType="{x:Type syncfusion:Node}">
                <Style.Setters>
                    <Setter Property="Template">
                        <Setter.Value>
                            <ControlTemplate TargetType="{x:Type syncfusion:Node}">
                                <Canvas x:Name="Part_Canvas">
                                    <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}"
                            CornerRadius="2"   Effect="{TemplateBinding CustomEffect}" Height="{TemplateBinding Height}" IsHitTestVisible="True" Width="{TemplateBinding Width}">
                                        <Border.BitmapEffect>
                                            <DropShadowBitmapEffect x:Name="ShadowEffect" Color="Gray" Direction="355" ShadowDepth="3" Softness="0.5" Opacity="0.3"/>
                                        </Border.BitmapEffect>
                                        <Grid IsHitTestVisible="True">
                                            <syncfusion:DragProvider x:Name="PART_DragProvider" IsHitTestVisible="True" Opacity="1" />
                                            <ContentPresenter ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" ContentSource="Content" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" Visibility="Visible" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
                                            <Border x:Name="PART_ConectorOver" IsHitTestVisible="False" Style="{Binding HitPathStyle}" Visibility="Collapsed"/>
                                            <syncfusion:Gripper IsHitTestVisible="True" Style="{Binding GripperStyle, Mode=TwoWay, RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type syncfusion:Node}}}" Visibility="{Binding GripperVisibility, Mode=TwoWay, RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type syncfusion:Node}}}"/>
                                        </Grid>
                                    </Border>
                                </Canvas>
                            </ControlTemplate>
                        </Setter.Value>
                    </Setter>
                </Style.Setters>
            </Style>

Attachment: DiagramTest_23f46d05.zip

Keerthivasan Ramamoorthy [Syncfusion]
Replied On January 26, 2017 01:43 AM

Hi Srikanth,  
Requirement:” Need to override the Template of the Node and ConnectionPort”.  
  
We have created simple sample to achieve your requirement. Please refer the sample link as below.  
Sample link: CustomNode
  
Sample Details:  
In our sample, we have override the ControlTemplate of the Node(Default Template) and override the ControlTemplate of the ConnectionPort to display Border and Grid elements inside the ConnectionPort with Label. 
 
Note: 
For details about Node Customization movement, please refer online documentation link as below. 
 
 
Please let us know if you require further assistance on this. 
 
Regards,  
Keerthivasan R. 


Srikanth
Replied On January 26, 2017 02:35 AM

Thanks a lot Keerthi. 

Appreciate your prompt response.


Keerthivasan Ramamoorthy [Syncfusion]
Replied On January 27, 2017 03:32 AM

Hi Srikanth,  
Thanks for your update. Please let us know, if you need any further assistance.  
  
Regards,  
Keerthivasan R. 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;