Hi!
I'm trying to get RadListBox accept items from RadTreeView but my RadListBox does not seem to accept drops from TreeView. Do I need to have somekind of converter even though the actual payload object is same as what I have loaded in the listbox. In treeview I'm using HierarchicalDataTemplate which shows individual users (User class) with some data from related entity tables. ListBox only shows user's username but it uses the same User class.
My other problem is how to handle drop event when dragging item from listbox to another listbox. Both listbox have AllowDrop=true and items can be dropped to each other but I'm not sure how to handle drop event as it does not seem to fire on drop. Do I need to use this DragAndDropManager?
Drag and Drop problems
I tried to follow Telerik's DragAndDrop samples but I'm little bit confused if I should use DragAndDropManager or not...
I just saw a post about renewing the RadTreeView, maybe I need to wait for that.
Br,
Kalle
I'm trying to get RadListBox accept items from RadTreeView but my RadListBox does not seem to accept drops from TreeView. Do I need to have somekind of converter even though the actual payload object is same as what I have loaded in the listbox. In treeview I'm using HierarchicalDataTemplate which shows individual users (User class) with some data from related entity tables. ListBox only shows user's username but it uses the same User class.
<Style x:Key=
"DraggableListBoxItem"
TargetType=
"telerik:RadListBoxItem"
>
<Setter Property=
"telerik:DragDropManager.AllowCapturedDrag"
Value=
"True"
/>
<Setter Property=
"telerik:DragDropManager.AllowDrag"
Value=
"True"
/>
<Setter Property=
"telerik:DragDropManager.TouchDragTrigger"
Value=
"TapAndHold"
/>
</Style>
<DataTemplate x:Key=
"ListBoxItemTemplate"
>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width=
"Auto"
/>
<ColumnDefinition Width=
"Auto"
/>
</Grid.ColumnDefinitions>
<Image Source=
"/Dashboard_UserExtension;component/Images/usericon.png"
Margin=
"10 0 0 0"
Width=
"16"
Height=
"16"
Grid.Column=
"0"
HorizontalAlignment=
"Left"
/>
<TextBlock Text=
"{Binding Username}"
FontSize=
"12"
FontFamily=
"Segoe UI"
Grid.Column=
"1"
Margin=
"10 0 0 0"
HorizontalAlignment=
"Left"
/>
</Grid>
</DataTemplate>
<telerik:RadListBox
x:Name=
"AdminUserBox"
AllowDrop=
"True"
ItemTemplate=
"{StaticResource ListBoxItemTemplate}"
ItemContainerStyle=
"{StaticResource DraggableListBoxItem}"
HorizontalAlignment=
"Left"
Margin=
"0,10,0,1"
Width=
"150"
ItemsSource=
"{Binding AdminUserList}"
Drop=
"AdminUserBox_Drop"
>
<telerik:RadListBox.DragVisualProvider>
<telerik:ScreenshotDragVisualProvider />
</telerik:RadListBox.DragVisualProvider>
<telerik:RadListBox.DragDropBehavior>
<telerik:ListBoxDragDropBehavior AllowReorder=
"True"
/>
</telerik:RadListBox.DragDropBehavior>
</telerik:RadListBox>
<telerik:RadTreeView x:Name=
"UserTreeView"
HorizontalAlignment=
"Left"
Margin=
"0,10,-2,0"
Width=
"220"
IsDragDropEnabled=
"True"
ItemTemplate=
"{StaticResource UserTemplate}"
ItemsSource=
"{Binding UserList}"
IsLoadOnDemandEnabled=
"False"
IsSingleExpandPath=
"True"
ItemContainerStyle=
"{StaticResource UsersItemContainerStyle}"
AllowDrop=
"False"
>
</telerik:RadTreeView>
My other problem is how to handle drop event when dragging item from listbox to another listbox. Both listbox have AllowDrop=true and items can be dropped to each other but I'm not sure how to handle drop event as it does not seem to fire on drop. Do I need to use this DragAndDropManager?
private
void
AdminUserBox_Drop(
object
sender, System.Windows.DragEventArgs e)
{
MessageBox.Show(
"Drop!"
);
// Not shown when dropping to AdminUserBox
}
Drag and Drop problems
I tried to follow Telerik's DragAndDrop samples but I'm little bit confused if I should use DragAndDropManager or not...
I just saw a post about renewing the RadTreeView, maybe I need to wait for that.
Br,
Kalle