This is a migrated thread and some comments may be shown as answers.
RadTaskBoard.DragDropBehavior
2 Answers 8 Views
This is a migrated thread and some comments may be shown as answers.
Brian
Top achievements
Rank 1
Brian asked on 18 Apr 2020, 06:33 PM

I'm trying to implement the custom Drag Drop behavior depicted at this link: https://docs.telerik.com/devtools/wpf/controls/radtaskboard/features/taskboardcolumndragdropbehavior#taskboardcolumndragdropbehavior

 However I cannot get the XAML to recognize this item 

<telerik:RadTaskBoard.DragDropBehavior>

 

The error message is 'The member "DragDropBehavior" is not recognized or is not accessible.

Regards,

2 Answers, 1 is accepted

Sort by
0
Martin Ivanov
Telerik team
answered on 22 Apr 2020, 06:08 AM

Hello  Brian,

The drag drop behavior is available since the R1 2020 SP1 version. Please double check if you are using this or a later version of Telerik UI for WPF.

Regards,
Martin Ivanov
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
0
Brian
Top achievements
Rank 1
answered on 24 Apr 2020, 02:14 PM

So that it may help others, the way to get this to work is implement a class that derives from TaskBoardColumnDragDropBehavior. Then override the methods that you need.

using Telerik.Windows.Controls.TaskBoard;
using Telerik.Windows.DragDrop.Behaviors;
 
public class TaskDragBehavior : TaskBoardColumnDragDropBehavior
{
 
    //CanStartDrag DragDropState Type: Telerik.Windows.DragDrop.Behaviors.DragDropState
    //CanDrop DragDropState Type: Telerik.Windows.Controls.TaskBoard.TaskBoardColumnDragDropState
    //DragDropCompleted DragDropState Type: Telerik.Windows.Controls.TaskBoard.TaskBoardColumnDragDropState
    //Drop DragDropState Type: Telerik.Windows.Controls.TaskBoard.TaskBoardColumnDragDropState
    //IsMovingItems DragDropState Type: Telerik.Windows.Controls.TaskBoard.TaskBoardColumnDragDropState
    //DragDropCanceled DragDropState Type: Telerik.Windows.Controls.TaskBoard.TaskBoardColumnDragDropState
 
 
    public TaskDragBehavior()
        : base()
    {
 
    }
 
    public override bool CanDrop(DragDropState state)
    {
        var dds = state as TaskBoardColumnDragDropState;
        return base.CanDrop(state);
    }
 
    public override bool CanStartDrag(DragDropState state)
    {
        return base.CanStartDrag(state);   
    }
 
    protected override IEnumerable<object> CopyDraggedItems(DragDropState state)
    {
        return base.CopyDraggedItems(state);
    }
 
    public override void DragDropCanceled(DragDropState state)
    {
        var dds = state as TaskBoardColumnDragDropState;
        base.DragDropCanceled(state);
    }
 
    public override void DragDropCompleted(DragDropState state)
    {
        var dds = state as TaskBoardColumnDragDropState;
        base.DragDropCompleted(state);
    }
 
    public override void Drop(DragDropState state)
    {
        var dds = state as TaskBoardColumnDragDropState;
        base.Drop(state);
    }
 
    protected override bool IsMovingItems(DragDropState state)
    {
        return base.IsMovingItems(state);
    }
 
}

 

Then in XAML you will need to implement the Drag Drop behavior.

<telerik:RadTaskBoard
    x:Name="taskBoard"
    GroupMemberPath="StatusGroup"
    AutoGenerateColumns="False"
    ItemsSource="{Binding MyTasks}"
    SelectedItem="{Binding SelectedModel}"
    >
    <-- Add the custon Drag Drop Behavior that you created. -->
    <telerik:RadTaskBoard.DragDropBehavior>
        <local1:TaskDragBehavior/>
    </telerik:RadTaskBoard.DragDropBehavior>
     
 
    <telerik:TaskBoardColumn Header="Backlog" GroupName="Backlog"/>
    <telerik:TaskBoardColumn Header="Hold" GroupName="Hold"/>
    <telerik:TaskBoardColumn Header="Active" GroupName="Active"/>
    <telerik:TaskBoardColumn Header="Completed" GroupName="Completed"/>
    <telerik:TaskBoardColumn Header="Cancelled" GroupName="Cancelled"/>
 
</telerik:RadTaskBoard>

 

After that all of the drag / drop events will be re-directed to the overridden handlers.

 

Regards,

 

 

Asked by
Brian
Top achievements
Rank 1
Answers by
Martin Ivanov
Telerik team
Brian
Top achievements
Rank 1
Share this question
or