Drag And Drop into a list nested in a listview

2 posts, 0 answers
  1. Patrick Emmisberger
    Patrick Emmisberger avatar
    3 posts
    Member since:
    Jan 2010

    Posted 30 Apr 2010 Link to this post

    I've a window with a listbox on the left half and a listview on the right half. The DataTemplate of the listview is set to a template which contains a listbox, so for every row of the listview a new listbox is created. Now I want to drag an item from the left half of the window into one of the nested listboxes on the right half. The problem is, that the nested listboxes aren't registered as drop target zones, although the AllowDrop-prop is set to true. If I set the AllowDrop-Property of the listview to true, the DropQuery-Event is raised, but the e.Options.Destination is always the listview, not the listbox inside it.

    Any help is appreciated.

    Thanks

    Patrick


  2. Tina Stancheva
    Admin
    Tina Stancheva avatar
    3298 posts

    Posted 05 May 2010 Link to this post

    Hello Patrick Emmisberger,

    Can you try setting a ItemContainerStyle for the ListView, like so:
    <Window.Resources>
             
    <DataTemplate x:Key="Template">
        <ListBox >
            <ListBoxItem Content="{Binding Name}"/>
        </ListBox>
    </DataTemplate>
     
    <Style TargetType="ListViewItem" x:Key="Style">
        <Setter Property="telerikDragDrop:RadDragAndDropManager.AllowDrop" Value="True"/>
    </
    Style>
             
    </Window.Resources>
     
     
    <ListView ItemContainerStyle="{StaticResource Style}" ItemTemplate="{StaticResource Template}" x:Name="listView" />

    This way in the DropInfo and DropQuery events the e.Options.Destination will point to the TreeViewItem.

    Give it a try and let me know how it goes.

    Best wishes,
    Tina Stancheva
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  3. UI for WPF is Visual Studio 2017 Ready
Back to Top