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

connector style

3 Answers 110 Views
Diagram
This is a migrated thread and some comments may be shown as answers.
nicolasf
Top achievements
Rank 2
nicolasf asked on 22 Nov 2017, 11:13 PM

Hi,

I would like define 1 style to my left connector (color blue) and 1 other style to my right connector (color red).

This is my code :

 

<core:ConnectorCollection x:Key="customConnectors">
    <telerik:RadDiagramConnector x:Name="Left" Offset="0 0.5" BorderBrush="Blue" Background="Blue" BorderThickness="1" />
    <telerik:RadDiagramConnector x:Name="Right" Offset="1 0.5" BorderBrush="Red" Background="Red" BorderThickness="1" />
    <telerik:RadDiagramConnector x:Name="Auto"
                                 Opacity="0"
                                 Offset="0.5 0.5" />
</core:ConnectorCollection>

 

But my code doesn't work

Can you help me please ?

Thanks,

Nicolas

3 Answers, 1 is accepted

Sort by
0
Dinko | Tech Support Engineer
Telerik team
answered on 27 Nov 2017, 12:31 PM
,

To add custom connectors you can take a look at the Custom Connectors help article in our documentation which describes this approach. Also, there is SDK example in our GitHub repository which demonstrates how to define custom connectors.

Regards,
Dinko
Progress Telerik
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
0
nicolasf
Top achievements
Rank 2
answered on 27 Nov 2017, 12:42 PM

Hi Dinko,

Thanks for your answez. I already use custom connector but the color define in my style doesn't take effect.

Have an example with two differents colors for one shape ?

Thanks,

Nicolas

0
Dinko | Tech Support Engineer
Telerik team
answered on 29 Nov 2017, 03:14 PM
Hello Nicolas,

I have modified the CustomConnectors SDK sample project to demonstrate how to set the color of a custom connector. In a few words, I have set the Background property of the RadDiagramConnector() in the DiagramLoaded() event handler.
private void DiagramLoaded(object sender, RoutedEventArgs e)
{
    this.diagram.Shapes.ToList().ForEach(x =>
    {
        var connectorUpRight = new RadDiagramConnector() { Offset = new Point(1, 0.25), Name = x.Name + "Connector1Right", Background=Brushes.Red };
. . . .

The project is attached to this reply. Give this project a try and let me know if it works for you.

Regards,
Dinko
Progress Telerik
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
Tags
Diagram
Asked by
nicolasf
Top achievements
Rank 2
Answers by
Dinko | Tech Support Engineer
Telerik team
nicolasf
Top achievements
Rank 2
Share this question
or