RadDiagramConnection SourceCapType

8 posts, 0 answers
  1. Brett
    Brett avatar
    14 posts
    Member since:
    Feb 2014

    Posted 03 Mar 2014 Link to this post

    I am using the Arrow5Filled and Arrow5 SourceCapType's to differentiate between 2 different join types in my diagram. When a user double clicks the join line I throw up a popup and allow them to enter/edit information about the join. The problem I am facing is that the Arrow5 SourceCapType is not clickable unless you get right on the line (very fiddly), opposed to the Arrow5Filled which is clickable anywhere in the shape. How can I make the Arrow5 SourceCapType to have the same behavior as the Arrow5Filled SourceCapType?
  2. Pavel R. Pavlov
    Admin
    Pavel R. Pavlov avatar
    1230 posts

    Posted 06 Mar 2014 Link to this post

    Hello,

    I assume that when you say "join line" you actually refer to the RadDiagramConnection control. If so, I think that I understand your scenario.
    I tested it in our online demos and it seems that the click event is registered even if you click inside the empty rectangle. Could you please give it a try and let me know if you can reproduce the reported behavior in our demo?

    In case that you are not able to reproduce the behavior in the online demo I suggest upgrading to our latest official release.

    Regards,
    Pavel R. Pavlov
    Telerik

    DevCraft Q1'14 is here! Join the free online conference to see how this release solves your top-5 .NET challenges. Reserve your seat now!

  3. Brett
    Brett avatar
    14 posts
    Member since:
    Feb 2014

    Posted 11 Mar 2014 in reply to Pavel R. Pavlov Link to this post

    You assume correctly and I am referring to RadDiagramConnection.

    I am subscribing to the mouse MouseDoubleClick event. I single click seems to work when I click inside the empty rectangle, however a double click does not work. I cannot really compare it to the demo that you linked me to as it doesnt seem to handle double clicks, only single clicks.
  4. Pavel R. Pavlov
    Admin
    Pavel R. Pavlov avatar
    1230 posts

    Posted 14 Mar 2014 Link to this post

    Hi Brett,

    When you double click on a RadDiagramConnection you actually activate the edit mode of that control. In edit mode you are able to enter text on top of the control.

    Regards,
    Pavel R. Pavlov
    Telerik
     

    DevCraft Q1'14 is here! Watch the online conference to see how this release solves your top-5 .NET challenges. Watch on demand now.

     
  5. Brett
    Brett avatar
    14 posts
    Member since:
    Feb 2014

    Posted 16 Mar 2014 in reply to Pavel R. Pavlov Link to this post

    I dont think that you are understanding the problem. I double click in the middle of a Arrow5Filled ​SourceCapType and the double click event is fired. I double click in the middle of a Arrow5 ​SourceCapType and the double click event is NOT fired. I need the Arrow5 to behave the same as the Arrow5Filled.
  6. Zarko
    Admin
    Zarko avatar
    755 posts

    Posted 19 Mar 2014 Link to this post

    Hi Brett,
    The problem is that when you click inside the empty rectangle no mouse event is fired(as far as I tested no doubleClick or mouseDown events) and that's why you'll have to use some thing else. 
    I think that the best way to do this is to handle the RadDiagram's MouseDoubleClick event and check if there's a connection around the mouse:
    private void OnDiagramMouseDoubleClick(object sender, MouseButtonEventArgs e)
    {
        var point = this.diagram.GetTransformedPoint(e.GetPosition(this.diagram));
        var connection = this.diagram.ServiceLocator.GetService<IHitTestService>().GetConnectionsUnderRect(new Rect(point.X - 2, point.Y - 2, 4, 4)).FirstOrDefault();
        if (connection != null)
        {
     
        }
    }
    (Note: you could try other methods from the hitTestService if you want - GetItemsNearPoint, GetTopItemNearPoint and etc.)
    I hope I was able to help you and if you need further assistance feel free to ask.

    Regards,
    Zarko
    Telerik
     

    DevCraft Q1'14 is here! Watch the online conference to see how this release solves your top-5 .NET challenges. Watch on demand now.

     
  7. Brett
    Brett avatar
    14 posts
    Member since:
    Feb 2014

    Posted 19 Mar 2014 Link to this post

    Hmm not the cleanest solution.

    Why does the Arrow5Filled source cap type fire the double click event? Is it because it has a filled background? Would it be possible to customise the Arrow5 source cap type and give it a background color (white) so it works the same way?
  8. Zarko
    Admin
    Zarko avatar
    755 posts

    Posted 24 Mar 2014 Link to this post

    Hi Brett,
    Yes, the Arrow5Filled cap fires a double click event because the PathFigure that is generated for it has its IsFilled property set to True. At the moment you can't customize the Arrow5 cap to have a white/transparent background (there's a Customizable Caps feature request in our FeedbackPortal) but you can do this with the Arrow5Filled type - you could always use Arrow5Filled cap but change the connections' background to transparent for some of them. Visually this:
    <telerik:RadDiagramConnection Background="Transparent" TargetCapType="Arrow5Filled" />
    will look like this:
    <telerik:RadDiagramConnection TargetCapType="Arrow5" />
    Note: if you se a background to a connection both of its caps will you it as fill color.
    I hope I was able to help you and if you have more questions feel free to ask.

    Regards,
    Zarko
    Telerik
     

    Build cross-platform mobile apps using Visual Studio and .NET. Register for the online webinar on 03/27/2014, 11:00AM US ET.. Seats are limited.

     
Back to Top