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

Issue with Drag&Drop in ListBox

0 Answers 80 Views
DragAndDrop
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Haidong
Top achievements
Rank 1
Haidong asked on 30 May 2012, 10:25 AM
I use below code to create two list box and drag&drop listboxitem between this two list.
Sometimes it works well. But sometime when I drag item from list1 to list2, the item can not be drop to the list2. The item go back to the list1.
Please notice that I use Data template for the listboxitem and the data template is a little complex.

Could someone help me on that?

<Style TargetType="ListBoxItem"
              x:Key="draggableItemStyle">
           <Setter Property="telerik:DragDropManager.AllowDrag"
                   Value="True" />
           <Setter Property="telerik:DragDropManager.AllowCapturedDrag"
                   Value="True" />
       </Style>


<
ListBox x:Name="MUL"
                             ItemsSource="{Binding List1, Mode=TwoWay}"
                             ItemContainerStyle="{StaticResource draggableItemStyle}"
                             AllowDrop="True"
                             Margin="10"
                             BorderBrush="{StaticResource BorderColor}">
                        <ListBox.ItemsPanel>
                            <ItemsPanelTemplate>
                                <controlsToolkit:WrapPanel Orientation="Horizontal"
                                                           Background="Transparent" />
                            </ItemsPanelTemplate>
                        </ListBox.ItemsPanel>
                        <ListBox.Template>
                            <ControlTemplate TargetType="ListBox">
                                <ScrollViewer HorizontalScrollBarVisibility="Disabled"
                                              VerticalScrollBarVisibility="auto"
                                              BorderThickness="0">
                                    <Grid Background="Transparent">
                                        <Border>
                                            <ItemsPresenter />
                                        </Border>
                                    </Grid>
                                </ScrollViewer>
                            </ControlTemplate>
                        </ListBox.Template>
                        <ListBox.ItemTemplate>
                            <DataTemplate>
                                  .......................
                            </DataTemplate>
                        </ListBox.ItemTemplate>
                        <telerik:ListBoxDragDrop.Behavior>
                            <telerik:ListBoxDragDropBehavior />
                        </telerik:ListBoxDragDrop.Behavior>
                        <telerik:ListBoxDragDrop.DragVisualProvider>
                            <telerik:ScreenshotDragVisualProvider />
                        </telerik:ListBoxDragDrop.DragVisualProvider>
                    </ListBox>
Tags
DragAndDrop
Asked by
Haidong
Top achievements
Rank 1
Share this question
or