DragDrop RadGridView Catch event Drop

3 posts, 0 answers
  1. francois
    francois avatar
    2 posts
    Member since:
    Jun 2009

    Posted 03 Nov 2014 Link to this post

    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. Kalin
    Admin
    Kalin avatar
    1208 posts

    Posted 04 Nov 2014 Link to this post

    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.

     
  3. DevCraft banner
  4. francois
    francois avatar
    2 posts
    Member since:
    Jun 2009

    Posted 05 Nov 2014 in reply to Kalin Link to this post

    Thank you, it works perfectly !

    Francois
Back to Top