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

DragDrop RadGridView Catch event Drop

2 Answers 85 Views
DragAndDrop
This is a migrated thread and some comments may be shown as answers.
francois
Top achievements
Rank 1
francois asked on 03 Nov 2014, 04:02 PM
Hi,
I have 2 RadListBox I have put a drag and drop event on it and it works!
The probleme is, i have to change value of "IsInGroup" to change the color of the items who change list!
But when i drop items they don't go on the event in "ListBox_Drop" and "ListBox2_Drop"

Code XAML
<telerik:RadListBox  AllowDrop="True" x:Name="ListBox"  Drop="ListBox_Drop"
SelectionMode="Extended" SelectedItem="{Binding SelectedClientAssigned, Mode=TwoWay}" ItemsSource="{Binding ClientAssignedList}" HorizontalAlignment="Left" VerticalAlignment="Stretch" >
   <telerik:RadListBox.ItemTemplate>
      <DataTemplate>
         <TextBlock Text="{Binding Alias}" Style="{Binding IsInGroup, Converter={StaticResource StyleFunctionConverter}}"/>
      </DataTemplate>
   </telerik:RadListBox.ItemTemplate>
   <telerik:RadListBox.DragDropBehavior >
   <telerik:ListBoxDragDropBehavior />
   </telerik:RadListBox.DragDropBehavior>
</telerik:RadListBox>
 
<telerik:RadListBox  AllowDrop="True" x:Name="ListBox2"  Drop="ListBox2_Drop"
SelectionMode="Extended" SelectedItem="{Binding SelectedClientNotAssigned, Mode=TwoWay}" ItemsSource="{Binding ClientNotAssignedList}" HorizontalAlignment="Left" VerticalAlignment="Stretch" >
   <telerik:RadListBox.ItemTemplate>
      <DataTemplate>
         <TextBlock Text="{Binding Alias}" Style="{Binding IsInGroup, Converter={StaticResource StyleFunctionConverter}}"/>
      </DataTemplate>
   </telerik:RadListBox.ItemTemplate>
   <telerik:RadListBox.DragDropBehavior >
   <telerik:ListBoxDragDropBehavior />
   </telerik:RadListBox.DragDropBehavior>
</telerik:RadListBox>

Code XAML.CS
private void ListBox2_Drop(object sender, Telerik.Windows.DragDrop.DragEventArgs e)
{
   ...
}
 
private void ListBox_Drop(object sender, Telerik.Windows.DragDrop.DragEventArgs e)
{
   ...
}

thank you

2 Answers, 1 is accepted

Sort by
0
Kalin
Telerik team
answered on 04 Nov 2014, 09:37 AM
Hello Francois,

What I can suggest you would be to implement a custom ListBoxDragDropBehavior and override the DragDropCompleted method in order to modify the dropped item as needed:

public class CustomListBoxDragDropBehavior: ListBoxDragDropBehavior
{
    public override void DragDropCompleted(DragDropState state)
    {
        // implement custom logic
        base.DragDropCompleted(state);
    }
}

You will be able to find the dropped item in the DraggedItems property of DragDropState parameter.

Hope this helps.

Regards,
Kalin
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
francois
Top achievements
Rank 1
answered on 05 Nov 2014, 10:34 AM
Thank you, it works perfectly !

Francois
Tags
DragAndDrop
Asked by
francois
Top achievements
Rank 1
Answers by
Kalin
Telerik team
francois
Top achievements
Rank 1
Share this question
or