I have a RadListBox that I am dragging items to a RadDiagram. This part works, but I can't figure out how to prevent reorder from within the RadListBox. I have tried several things. I just want to prevent the horizontal line from showing when the item is dragged away from the listboxand move to a different position within the list box.
This is my current code.
Xaml (Simplified to focus on problem)
01.
<
UserControl
>
02.
<
UserControl.Resources
>
03.
<
Style
x:Key
=
"DraggableListBoxItem"
TargetType
=
"telerik:RadListBoxItem"
BasedOn
=
"{StaticResource RadListBoxItemStyle}"
>
04.
<
Setter
Property
=
"telerik:DragDropManager.AllowDrag"
Value
=
"True"
/>
05.
</
Style
>
06.
</
UserControl.Resources
>
07.
08.
<
Grid
Margin
=
"5"
>
09.
<
Grid.ColumnDefinitions
>
10.
<
ColumnDefinition
Width
=
"Auto"
/>
11.
<
ColumnDefinition
Width
=
"*"
/>
12.
</
Grid.ColumnDefinitions
>
13.
14.
<
Grid
>
15.
<
telerik:RadListBox
Margin
=
"0 10 0 0"
Width
=
"250"
Grid.IsSharedSizeScope
=
"True"
16.
Background
=
"Transparent"
ScrollViewer.HorizontalScrollBarVisibility
=
"Disabled"
AllowDrop
=
"False"
17.
ItemContainerStyle
=
"{StaticResource DraggableListBoxItem}"
18.
ItemsSource
=
""
>
19.
<
telerik:RadListBox.DragDropBehavior
>
20.
<
behaviors:DatasourceDragDropBehavior
AllowReorder
=
"False"
/>
21.
</
telerik:RadListBox.DragDropBehavior
>
22.
23.
<
telerik:RadListBox.DragVisualProvider
>
24.
<
telerik:ScreenshotDragVisualProvider
/>
25.
</
telerik:RadListBox.DragVisualProvider
>
26.
27.
<
telerik:RadListBox.ItemTemplate
>
28.
<
DataTemplate
>
29.
<
Grid
>
30.
</
Grid
>
31.
</
DataTemplate
>
32.
</
telerik:RadListBox.ItemTemplate
>
33.
</
telerik:RadListBox
>
34.
</
Grid
>
35.
36.
<
Grid
>
37.
<
telerik:RadDiagram
IsSnapToGridEnabled
=
"True"
BorderThickness
=
"1"
BorderBrush
=
"Black"
>
38.
</
telerik:RadDiagram
>
39.
</
Grid
>
40.
</
Grid
>
41.
</
UserControl
>
Behavior
01.
class
DatasourceDragDropBehavior : ListBoxDragDropBehavior
02.
{
03.
public
override
void
DragDropCompleted(DragDropState state)
04.
{
05.
//implement some custom logic here
06.
//Do not call -> base.DragDropCompleted(state);
07.
}
08.
09.
public
override
bool
CanDrop(DragDropState state)
10.
{
11.
return
state.IsSameControl ==
false
;
12.
}
13.
}