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

Custom RadDiagramConnection

1 Answer 17 Views
Diagram
This is a migrated thread and some comments may be shown as answers.
Tatiana
Top achievements
Rank 1
Tatiana asked on 24 Oct 2018, 10:55 PM

Hello again!

I'd like to create custom class that is RadDiagramConnection and has its full functionality within RadDiagram , but with some additional data ( implementation of additional interface).

When I am creating it via inheriting from RadDiagramConnection ( as it is recommended in Telerik documentation here: https://docs.telerik.com/devtools/wpf/controls/raddiagram/howto/create-custom-connectioncap ).

But when I add it to my RadDiagram, I see nothing. As I know where my LineObject is I can click on it and see 2 ancor-points, but I can not see RadDiagramConnection itself. Picture is attached.

Would you be so kind to tell me how I can implement this thing?

This is my .cs file

public class LineObject : RadDiagramConnection
 {
      
}

This is my Xaml file:

    <telerik:RadDiagram  >
        <telerik:RadDiagramConnection StartPoint="250,250" EndPoint="150,150"
                                          SourceCapType="Arrow1Filled" TargetCapType="Arrow1Filled"
                                          SourceCapSize="20,20" TargetCapSize="20, 20"
                                          StrokeThickness="5" Background="Red"
                                          Stroke="Red"
                                          />
        <imageeditor:LineObject StartPoint="150,250" EndPoint="250,150"
                                          SourceCapType="Arrow1Filled" TargetCapType="Arrow1Filled"
                                          SourceCapSize="20,20" TargetCapSize="20, 20"
                                          StrokeThickness="5" Background="Blue"
                                          Stroke="Blue" />
 
</telerik:RadDiagram>

 

Best regards,
Tatiana

1 Answer, 1 is accepted

Sort by
0
Tatiana
Top achievements
Rank 1
answered on 24 Oct 2018, 11:10 PM

While I was waiting I occasionally found the solution :)

Forgot about no inheritance of parents Style while inheriting Controls. So the following fix solved the problem:

public LineObject() : base()
{         
    Style = FindResource(typeof(RadDiagramConnection)) as Style;
}
Tags
Diagram
Asked by
Tatiana
Top achievements
Rank 1
Answers by
Tatiana
Top achievements
Rank 1
Share this question
or