Disable Relations

4 posts, 0 answers
  1. Nathan
    Nathan avatar
    7 posts
    Member since:
    Jun 2014

    Posted 16 Jun 2014 Link to this post

    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)
  2. Polya
    Admin
    Polya avatar
    200 posts

    Posted 18 Jun 2014 Link to this post

    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.
     
  3. UI for WPF is Visual Studio 2017 Ready
  4. Nathan
    Nathan avatar
    7 posts
    Member since:
    Jun 2014

    Posted 18 Jun 2014 Link to this post

    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?
  5. Polya
    Admin
    Polya avatar
    200 posts

    Posted 19 Jun 2014 Link to this post

    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.
     
Back to Top