I have a RadListBox with DragDropBehavior, the RadListBox itemtemplates contain a textbox. I want the text in the textbox to be selectable using the mouse, but when I drag to select text, the item is dragged instead. Is it possible to disable drag within a control in an itemtemplate in a draggable RadListBox? I tried setting telerik:DragDropManager.AllowCapturedDrag="False" and telerik:DragDropManager.AllowDrag="False" on the textbox but that doesn't help.
Here's my little test project:
Here's my little test project:
using
System.Collections.ObjectModel;
namespace
ListBoxTest
{
public
partial
class
MainWindow
{
public
MainWindow()
{
InitializeComponent();
DataContext =
this
;
MyCollection =
new
ObservableCollection<
string
> {
"test text 1"
,
"test text 2"
,
"test text 3"
,
"test text 4"
,
"test text 5"
,
"test text 6"
};
}
public
ObservableCollection<
string
> MyCollection {
get
;
private
set
; }
}
}
<
Window
x:Class
=
"ListBoxTest.MainWindow"
xmlns:telerik
=
"http://schemas.telerik.com/2008/xaml/presentation"
Title
=
"MainWindow"
Height
=
"500"
Width
=
"525"
>
<
telerik:RadListBox
ItemsSource
=
"{Binding MyCollection}"
>
<
telerik:RadListBox.ItemTemplate
>
<
DataTemplate
>
<
Grid
Height
=
"50"
Width
=
"100"
Background
=
"LightBlue"
telerik:DragDropManager.AllowCapturedDrag
=
"True"
>
<
TextBox
Text
=
"{Binding .}"
VerticalAlignment
=
"Center"
HorizontalAlignment
=
"Center"
telerik:DragDropManager.AllowCapturedDrag
=
"False"
telerik:DragDropManager.AllowDrag
=
"False"
/>
</
Grid
>
</
DataTemplate
>
</
telerik:RadListBox.ItemTemplate
>
<
telerik:RadListBox.DragDropBehavior
>
<
telerik:ListBoxDragDropBehavior
/>
</
telerik:RadListBox.DragDropBehavior
>
</
telerik:RadListBox
>
</
Window
>