Drag drop functionality between 2 different controls

6 posts, 0 answers
  1. Kamlesh
    Kamlesh avatar
    12 posts
    Member since:
    Nov 2008

    Posted 01 Dec 2008 Link to this post

    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?
  2. Miroslav
    Admin
    Miroslav avatar
    922 posts

    Posted 02 Dec 2008 Link to this post

    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):

    <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.
  3. DevCraft banner
  4. Nilesh
    Nilesh avatar
    4 posts
    Member since:
    Mar 2009

    Posted 05 Mar 2009 Link to this post

    hye,

    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" ?

     

  5. Miroslav
    Admin
    Miroslav avatar
    922 posts

    Posted 05 Mar 2009 Link to this post

    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.
  6. Joe
    Joe avatar
    3 posts
    Member since:
    May 2009

    Posted 04 Jun 2009 Link to this post

    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.
  7. Miroslav
    Admin
    Miroslav avatar
    922 posts

    Posted 05 Jun 2009 Link to this post

    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.
Back to Top
DevCraft banner