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

Avoiding links to change its connector

8 Answers 94 Views
Diagram
This is a migrated thread and some comments may be shown as answers.
Barış
Top achievements
Rank 1
Barış asked on 04 Sep 2015, 02:02 PM

I need to fix the connector of the links, but despite the actions I took, connections jumps to another connector while dragging the shape. My sample is a typical hiearchy view, and this makes the relationship is looking reversed. 

 This is my link 

<Setter Property="SourceConnectorPosition" Value="Bottom"/>
<Setter Property="TargetConnectorPosition" Value="Top"/>

And I have only two connector. 

 

<core:ConnectorCollection x:Key="customConnectors">
  <telerik:RadDiagramConnector Offset="0.5 0" Name="Top"  Background="MediumVioletRed"/>
  <telerik:RadDiagramConnector Offset="0.5 1" Name="Bottom"  Background="YellowGreen"/>
</core:ConnectorCollection>

 Defined in the Shape style setter.

<Setter Property="clocLink:AttachedProperties.CustomConnectors" Value="{StaticResource customConnectors}" />

Thank you for your help.  

 

8 Answers, 1 is accepted

Sort by
0
Petar Mladenov
Telerik team
answered on 09 Sep 2015, 07:04 AM
Hi Barış,

I guess you have set UseDefaultConnectors = False or you have deleted the 5 built-in connectors from the shapes via custom code. In both cases I encourage you to name the custom connectors with names which do not contains the words "Auto", "Top", "Bottom", "Left", "Right". Or at least the names should be different than the mentioned 5 words. Diargam has custom built-in code for detecting the connectors based on their names if they include these words.

Please let us know if this helps you move forward.

Regards,
Petar Mladenov
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Barış
Top achievements
Rank 1
answered on 15 Sep 2015, 07:14 AM

Hi Petar,

Thank you for your help, but It didn't work. I just rename the connector names as it follows:

<Setter Property="SourceConnectorPosition" Value="Superior"/><br><Setter Property="TargetConnectorPosition" Value="Subordinate"/>

<core:ConnectorCollection x:Key="customConnectors">
  <telerik:RadDiagramConnector Offset="0.5 0" Name="Superior"  Background="MediumVioletRed"/>
  <telerik:RadDiagramConnector Offset="0.5 1" Name="Subordinate"  Background="YellowGreen"/>
</core:ConnectorCollection>

The problem is despite the items count on InternalItems and Internallinks increases, there is no change in ui. The nodes are not displayed at all. 

 

Please note that I set UseDefaultConnector to both true and false, but the result was the same. 

 Thank you in advance. 

0
Petar Mladenov
Telerik team
answered on 17 Sep 2015, 11:59 AM
Hi Barış,

You may have hit a timing issue (style applying too late) or you may have used older version of Telerik UI for WPF. What is you Telerik UI version ?

Also, the provided code is highly insufficient for us in order to replicate such issue on our side. We are not sure how you populate your diagram, how you create your custom connectors and etc.

We prepared a sample project for you in which Diagram is bound to GraphSource, connectors are created with attached property and on a button click we add a connection between two shapes. Is it possible for you to modify the project so that your issue is reproducible. Or, on the other hand, you open a new support thread with an isolated project we can investigate more precisely on our side. Thank you in advance for your cooperation.

Regards,
Petar Mladenov
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Barış
Top achievements
Rank 1
answered on 29 Sep 2015, 06:42 AM

Hi Petar, 

I implemented your sample in my project. But result is the same. The code in first entry, your sample, and derived DiagramShapeBase implementation (And add connectors in constructors), all ended up with same exception. It throws an exception that says "connector 'Bottom' does not exist" with the below stack trace. In all sample, the connectors are shown as I want them to be. But problem occurs when I call AddLink function of GraphSource.

here is my Link style

<Style TargetType="telerik:RadDiagramConnection" x:Key="BaseLinkStyle">
  <Setter Property="Stroke"  Value="{Binding RelationType, Converter={StaticResource RelationTypeToColorConverter},Mode=TwoWay}" />
  <!--<Setter Property="StrokeThickness" Value="2" />-->
  <Setter Property="StrokeDashArray" Value="1,0" />
  <Setter Property="SourceCapType" Value="Arrow4Filled" />
  <Setter Property="TargetCapType" Value="Arrow5Filled" />
  <Setter Property="Visibility" Value="{Binding IsVisible, Converter={StaticResource BooleanToVisibilityConverter}, Mode=TwoWay}" />
  <Setter Property="SourceConnectorPosition" Value="Subordianate"/>
  <Setter Property="TargetConnectorPosition" Value="Superior"/>
  <Setter Property="Foreground" Value="#58514A" />
  <Setter Property="EditTemplate" Value="{StaticResource LinkEditTemplate}" />
  <Setter Property="ContentTemplate">
    <Setter.Value>
      <DataTemplate>
        <Border BorderThickness="0.5" BorderBrush="#5C5C5C">
          <TextBlock Text="{Binding RelationType,Mode=TwoWay}" FontSize="15" FontWeight="Bold" Foreground="White" />
        </Border>
      </DataTemplate>
    </Setter.Value>
  </Setter>
</Style>

  

 And here is the stack when exception occured.

 at Telerik.Windows.Controls.RadDiagramConnection.ResolveSourceConnector()
   at Telerik.Windows.Controls.RadDiagramConnection.OnSourceConnectorPositionChanged(String newPosition, String oldPosition)
   at Telerik.Windows.Controls.RadDiagramConnection.OnSourceConnectorPositionPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
   at System.Windows.DependencyObject.RaisePropertyChangeNotifications(DependencyProperty dp, Object oldValue, Object newValue)
   at System.Windows.DependencyObject.UpdateEffectiveValue(DependencyProperty property, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, ValueOperation operation)
   at System.Windows.DependencyObject.SetValueInternal(DependencyProperty dp, Object value, Boolean allowReadOnlySet, Boolean isBindingInStyleSetter)
   at Telerik.Windows.Controls.RadDiagramConnection.set_SourceConnectorPosition(String value)
   at Telerik.Windows.Diagrams.Core.OrgTreeRouter.DirectionalRouter.SetSourceAndTargetConnectors()

 

I also tried to implement a sample solution, but could not reproduce one without implementing all the futures.

I would appreciate it a lot if you could provide more hint.

Regards,

0
Barış
Top achievements
Rank 1
answered on 29 Sep 2015, 07:01 AM

Hi Petar, I renamed the connectors to "Bottom" and "Top". It was getting an error with my samples. But with the sample you upload. It did work with only one differences. When I placed the connector to somewhere else than middle, It routes the middlepoint as well. 

 Please see the attached file.

I will still need more connector couples but I can rename one of them as Bottom and Top. What do you suggest?

0
Petar Mladenov
Telerik team
answered on 30 Sep 2015, 08:50 AM
Hi Baris,

Again we want to ask you what is the version of Telerik UI for WPF that you use ? This is very important because:
- we usually test our code with the lastet released versions
- you may have hit a bug that is already fixed in newer versions and it's always easier to upgrade instead of creating a wrorkaround for older versions

From the last stack trace we see you use Directional Router. Can we ask you to try AStarRouter instead and check if it produces better results in your scenario ?

Also we encourage you to open a new support thread where your are able to attach files and where your 24 hours reponse time from us is guaranteed. Please describe more detailed the code you use and the steps you perform leading to some behavior / result you need to change. This way we would be better able to address the issue and advice you better. 

What should we change in our last test project attached here to replicate the behavior you describe on the picture ?

Regards,
Petar Mladenov
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Barış
Top achievements
Rank 1
answered on 20 Oct 2015, 09:14 AM

Hi Petar, 

We use 2015.2.623.1050 version of the Telerik UI for Silverlight. I think it was a mistake that you write Telerik UI for WPF in your two posts but you also share the link of A-StarRouter from Telerik UI for WPF source. 

Since I used almost every feature of the diagram, I can not recreate the problem with sample reduced solutions. Unfortunately, the customer only allows the atomal information to be shared, I can not share the current project itself (It is a military project). 

 And I almost tried every possible way to achieve it, but I think problem is not with code I share, but with an other feature. 

I also tried your AStarRouter suggestion. I was using orgtreerouter and replaced it with AStarRouter. But since I used a graph source inherited from SeriazableGraphSource not IGraphInternal, it was useless. I did not try to implement IGraphInternal because my code is already too complex as it is. 

I now focused the other parts of the component and decided to solve this later. IIf there is something you think I should check, please let me know.

Regards,

Barış

0
Petar Mladenov
Telerik team
answered on 23 Oct 2015, 07:11 AM
Hello Barış,

The API in RadDiagram between WPF and Silverlight is almost the same and we almost never have issues for only on of the two platforms.
Back to the original, issue, could you please again list the features (databinding router, custom connectors, properties you set on the in Diagram you use and the main problem. Can you capture it in a video ? This way we will try to reproduce it on our side and advice you better.
Also , we are not sure why you can't use AStarRouter, there is no dependency between the GraphSource and the router type. Could you please elaborate a bit more on this ?


Regards,
Petar Mladenov
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
Diagram
Asked by
Barış
Top achievements
Rank 1
Answers by
Petar Mladenov
Telerik team
Barış
Top achievements
Rank 1
Share this question
or