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

Disable Relations

3 Answers 120 Views
GanttView
This is a migrated thread and some comments may be shown as answers.
Nathan
Top achievements
Rank 1
Nathan asked on 16 Jun 2014, 11:42 PM
What's the best way of disabling the ability for viewers/users to add relations between tasks?

Is there a way of doing it similar to disabling drag-and-drop/resizing?  (over-wrote CanStartDrag, CanDrop, CanStartResize, CanResize, etc)

3 Answers, 1 is accepted

Sort by
0
Polya
Telerik team
answered on 18 Jun 2014, 10:58 AM
Hi Nathan,

In order to disable adding relations between GanttTasks you need a custom GanttDragDependenciesBehavior and override the CanStartLink/CanLink methods.

public class CustomDragDependenciesBehavior : GanttDragDependenciesBehavior
{
    protected override bool CanStartLink(SchedulingLinkState state)
    {
        return false;      
    }
 
    protected override bool CanLink(SchedulingLinkState state)
    {
        return false;
    }
}

Then use this behavior in the RadGanttView as a DragDependenciesBehavior:

<telerik:RadGanttView TasksSource="{Binding GanttTasks}" VisibleRange="{Binding VisibleRange}">
    <telerik:RadGanttView.Columns>
        ...
    </telerik:RadGanttView.Columns>
    <telerik:RadGanttView.DragDependenciesBehavior>
        <local:CustomDragDependenciesBehavior/>
    </telerik:RadGanttView.DragDependenciesBehavior>
</telerik:RadGanttView>

Also you can take a look at our RadGanttView LockingFunctions example where we demonstrate how to disable adding relations, drag&drop and resizing GanttTasks. The examples can be downloaded from this link.

Hopefully this helps.

Regards,
Polya
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.
 
0
Nathan
Top achievements
Rank 1
answered on 18 Jun 2014, 10:02 PM
I've figured out how to disable creating relations between tasks.  But the tooltip that says "Drag to create a relation" still appears.
Is it possible to disable this tooltip from appearing?
0
Polya
Telerik team
answered on 19 Jun 2014, 12:39 PM
Hello Nathan,

In order to stop showing the "Drag to create a relation" we need to remove this ToolTip from the ControlTemplate of the DependencyIndicator. Then we need to use this new ControlTemplate in the Style of the DependencyIndicator and apply this style for the DependencyIndicators in the ControlTemplate of the EventDecoratorContainer.
Please find attached a sample project demonstrating this styling. Note that the project uses Implicit Styles.

Give it a try and let me know if it works for you.

Regards,
Polya
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
GanttView
Asked by
Nathan
Top achievements
Rank 1
Answers by
Polya
Telerik team
Nathan
Top achievements
Rank 1
Share this question
or