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

Drag Selecting Item not Drop file

0 Answers 81 Views
ListBox
This is a migrated thread and some comments may be shown as answers.
John
Top achievements
Rank 1
John asked on 09 Dec 2012, 07:08 AM
Hi,

I'm try this code for drag selecting item if set AllowDrop true not drag and drop file in listbox.

<Window.Resources>
    <Style TargetType="telerik:RadListBoxItem">
        <Setter Property="telerik:DragDropManager.AllowCapturedDrag" Value="True" />
    </Style>
</Window.Resources>
<Window.DataContext>
    <local:ExampleViewModel />
</Window.DataContext>
 
<Grid Background="White" x:Name="LayoutRoot">
    <telerik:RadListBox ItemsSource="{Binding CountryList}" AllowDrop="True" x:Name="listBox" Height="200"
                        HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
        <telerik:RadListBox.ItemTemplate>
            <DataTemplate>
                <Grid Height="50" Width="100" Background="LightBlue" telerik:DragDropManager.AllowDrag="False">
                    <TextBox Text="{Binding CountryName}"
                             VerticalAlignment="Center"
                             PreviewMouseLeftButtonDown="TextBox_PreviewMouseLeftButtonDown"
                             MouseLeave="TextBox_MouseLeave"
                             HorizontalAlignment="Center"/>
                </Grid>
            </DataTemplate>
        </telerik:RadListBox.ItemTemplate>
        <telerik:RadListBox.DragDropBehavior>
            <telerik:ListBoxDragDropBehavior AllowReorder="True"/>
        </telerik:RadListBox.DragDropBehavior>
        <telerik:RadListBox.DragVisualProvider>
            <telerik:ScreenshotDragVisualProvider />
        </telerik:RadListBox.DragVisualProvider>
        <telerik:RadListBox.DropVisualProvider>
            <telerik:LinearDropVisualProvider />
        </telerik:RadListBox.DropVisualProvider>
    </telerik:RadListBox>

No answers yet. Maybe you can help?

Tags
ListBox
Asked by
John
Top achievements
Rank 1
Share this question
or