In my application I am using RAD controls for silverlight. I have a grid view and a treeview control. I need a functionality where we can multiselect rows from grid view and can drop the selection on any treeview node. Is it possible using DragDropManager and related events? Can you please provide some guidance (may be some sample code) on this?
5 Answers, 1 is accepted
0
Hi Kamlesh,
Yes, it is possible to implement drag-drop between different controls. Unfortunately the GridView is currently in CTP status, which means that some of the functionality is not there yet.
What you need to do is set the AllowDrag property of the grid rows to true and the AllowDrop property of the TreeView items to true.
The following code should work in the near future (though unfortunately not now):
You can set the attached properties in code as well, but again I am afraid this option is not available for the Silverlight grid view.
Afterwards you will need to handle the routed drag/drop events as you would normally do.
Greetings,
Miroslav
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Yes, it is possible to implement drag-drop between different controls. Unfortunately the GridView is currently in CTP status, which means that some of the functionality is not there yet.
What you need to do is set the AllowDrag property of the grid rows to true and the AllowDrop property of the TreeView items to true.
The following code should work in the near future (though unfortunately not now):
<Grid> |
<Grid.ColumnDefinitions> |
<ColumnDefinition Width="*" /> |
<ColumnDefinition Width="3*" /> |
</Grid.ColumnDefinitions> |
<nav:RadTreeView x:Name="treeView"> |
<nav:RadTreeView.ItemContainerStyle> |
<Style TargetType="nav:RadTreeViewItem"> |
<Setter Property="dragDrop:RadDragAndDropManager.AllowDrop" Value="True" /> |
<Setter Property="Foreground" Value="Red" /> |
</Style> |
</nav:RadTreeView.ItemContainerStyle> |
</nav:RadTreeView> |
<grid:RadGridView x:Name="gridView" Grid.Column="1"> |
<grid:RadGridView.RowAppearance> |
<grid:RowAppearanceSettings> |
<grid:RowAppearanceSettings.RowStyle> |
<Style TargetType="gridView:GridViewRow"> |
<Setter Property="dragDrop:RadDragAndDropManager.AllowDrag" Value="True" /> |
<Setter Property="Foreground" Value="Red" /> |
</Style> |
</grid:RowAppearanceSettings.RowStyle> |
</grid:RowAppearanceSettings> |
</grid:RadGridView.RowAppearance> |
</grid:RadGridView> |
</Grid> |
You can set the attached properties in code as well, but again I am afraid this option is not available for the Silverlight grid view.
Afterwards you will need to handle the routed drag/drop events as you would normally do.
Greetings,
Miroslav
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Nilesh
Top achievements
Rank 1
answered on 05 Mar 2009, 10:20 AM
hye,
the line
<Setter Property="dragDrop:RadDragAndDropManager.AllowDrop" Value="True" />
gives error "invalid attribute value"
do we need to set anything to dragdrop in
the line
<Setter Property="dragDrop:RadDragAndDropManager.AllowDrop" Value="True" />
gives error "invalid attribute value"
do we need to set anything to dragdrop in
xmlns
:telerik="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls" ?
0
Hello Nilesh,
You need to include the DragDrop namespace:
xmlns:dragDrop="clr-namespace:Telerik.Windows.Controls.DragDrop;assembly=Telerik.Windows.Controls"
Hopefully this will work for you,
Greetings,
Miroslav
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
You need to include the DragDrop namespace:
xmlns:dragDrop="clr-namespace:Telerik.Windows.Controls.DragDrop;assembly=Telerik.Windows.Controls"
Hopefully this will work for you,
Greetings,
Miroslav
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Joe
Top achievements
Rank 1
answered on 04 Jun 2009, 04:48 PM
Can you confirm if drag-drop is feasible between rad treeview and rad gridview in the current release? If possible, is there an example of this between the 2 controls. Thanks.
0
Hello Joe,
Have you seen the BugTrakcer sample application? There you an see drag/drop between TreeView / GridView / ListBox:
http://blogs.telerik.com/miroslavpaskov/posts/09-05-15/silverlight_dragdrop_hello_real_world_application.aspx
Currently it is only possible to drag a single row away from the GridView, but with the next release I expect that you will be able to drag multiple rows as well.
We will be happy to help you with any difficulties you encounter.
All the best,
Miroslav
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Have you seen the BugTrakcer sample application? There you an see drag/drop between TreeView / GridView / ListBox:
http://blogs.telerik.com/miroslavpaskov/posts/09-05-15/silverlight_dragdrop_hello_real_world_application.aspx
Currently it is only possible to drag a single row away from the GridView, but with the next release I expect that you will be able to drag multiple rows as well.
We will be happy to help you with any difficulties you encounter.
All the best,
Miroslav
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.