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

Org Chart - Drag over a Team Member / GetShapeUnderDragPosition()

2 Answers 91 Views
Diagram
This is a migrated thread and some comments may be shown as answers.
Jean-Christophe
Top achievements
Rank 1
Jean-Christophe asked on 25 Aug 2014, 09:27 AM
Hello,

    I'm currently modifying the OrgChart example to add the ability to build a hierarchy inside a team (a team member can have children team member).
    To be able to know if the user is dragging a Team Member over another one I've modified the OgChartDiagram.GetShapeUnderPosition() to be able to get a list of shapes instead of the top shape :

public List<RadDiagramShape> GetShapeUnderDragPosition()
{
    List<IShape> ShapeList = this.ServiceLocator.GetService<IHitTestService>().GetTopShapesUnderPoint(this.currentDragPosition).ToList();
 
    List<RadDiagramShape> RetList = new List<RadDiagramShape>();
 
    foreach (IShape shape in ShapeList)
    {
        if (shape is RadDiagramShape)
        {
            RetList.Add((RadDiagramShape)shape);
        }
    }
 
    return RetList;
}

My problem is that the method always return a single team item, never a team member.
(I also changed the inheritance of OrgTeamMemberViewModel to make it inherit from HierarchicalNodeViewModel instead of ViewModelBase..

is GetTopShapesUnderPoint() the right method to use for this ?

Thanks !

2 Answers, 1 is accepted

Sort by
0
Jean-Christophe
Top achievements
Rank 1
answered on 25 Aug 2014, 12:16 PM
mmm... maybe I'm not sufficiently clear.

Simply put, I want to know if there is a simple way to check (inside the Org Chart sample) if the user is draging over a Team OR a Team Member.

I know that the default Org Chart sample easily checks for Teams, but can't find a way to check if the mouse point is over a Team Member....
0
Pavel R. Pavlov
Telerik team
answered on 27 Aug 2014, 02:43 PM
Hello,

I suppose that you are talking about the GetShapeUnderDragPosition() method. If so, you are on the right way for customizing the example. Please note that in the method we are using the HitTestService to get the shape(s) under the mouse. 

Are you saying that the method does not return the shape that is hovered when dragging?

Regards,
Pavel R. Pavlov
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
Tags
Diagram
Asked by
Jean-Christophe
Top achievements
Rank 1
Answers by
Jean-Christophe
Top achievements
Rank 1
Pavel R. Pavlov
Telerik team
Share this question
or