This is a migrated thread and some comments may be shown as answers.

Drag & drop and Hierarchy

7 Answers 194 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Wang
Top achievements
Rank 1
Wang asked on 19 Jan 2016, 09:48 AM

Hello!

I have two problem,

1:

Is there  some method to  Drag & drop  only in parent gridview self and Hierarchy gridview self?

for eg. 

p1

     sub1

     sub2

     sub3

p2

    sub4

    sub5

    sub6

p3

    sub7
    sub8
    sub9

 

can we Drag & drop only between p1,p2,p3 for order

and Drag & drop only between sub1 sub2 sub3…

 

 2.

Is there  some method to  Drag & drop  only in parent gridview self and gridview in RowDetailsTemplate self?

 

It is a big forever If you can provide a sample! thanks a lot!!

7 Answers, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 21 Jan 2016, 02:45 PM
Hello Wang,

In general, this requirement can be achieved by setting the AllowDrop property of a given GridViewRow to "False". I suggest you taking a look at the Drag and Drop within RadGridView help topic. If you review the OnRowDragOver event handler method, you will notice that the sender object is the currently dragged row. So, you can implement custom logic depending on whether a given row is an item of the parent collection or the child one, and set its AllowDrop property as per your requirements.

Hope this helps.

All the best,
Stefan X1
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Wang
Top achievements
Rank 1
answered on 22 Jan 2016, 07:09 AM

Hello Stefan X1 ,

I looked at the Drag and Drop within RadGridView topic and it worked well in one GridView,and try to setting the AllowDrop property in OnRowDragOver event handler method in Hierarchy gridview by HierarchyChildTemplate,but it did not work fine, may be I set it to a wrong way,can you provide a sample? thanks a lot!!

best wishes!

0
Stefan
Telerik team
answered on 25 Jan 2016, 05:23 PM
Hello Wang,

Can you please share some details on the difficulties you are experiencing at your end? Basically, you need to set the AllowDrop property of the hierarchical grid to "True" and apply a Style targeting its GridViewRow elements that sets the AllowDrag property to "True". You need to also ensure, that you have enabled the RowReorderBehavior for the hierarchical grid, as demonstrated in the article I referred to in my previous post.

You can also check out the relevant SDK Example using the SDK Samples Browser.

Best Regards,
Stefan X1
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Wang
Top achievements
Rank 1
answered on 01 Feb 2016, 04:36 AM

Hello Stefan X1,

I tried to set the AllowDrop property and set row AllowDrop property in OnRowDragOver event,

there's no DropPositionFeedback  when I DragOver a child to anther child, but it can be shown when I drag a parent to anther parent.

here is my xaml code:

<telerik:RadGridView x:Name="StageGrid" GroupRenderMode="Flat"
SelectionMode="Extended"
CanUserFreezeColumns="False" ColumnWidth="*"
ItemsSource="{Binding StageCollection}"
GridLinesVisibility="None" RowIndicatorVisibility="Collapsed"
AutoGenerateColumns="False" IsFilteringAllowed="False"
ShowGroupPanel="False" SelectionChanged="StageGrid_SelectionChanged"
AllowDrop="True" behavior:RowReorderBehavior.IsEnabled="True">
            <telerik:RadGridView.Resources>
                <DataTemplate x:Key="DraggedItemTemplate">
                    <StackPanel>
                        <TextBlock Text="{Binding CurrentDraggedItem.Name}" FontWeight="Bold" />
                    </StackPanel>
                </DataTemplate>
                <converter:IntegerToBooleanConverter x:Key="integerToBooleanConverter" />
            </telerik:RadGridView.Resources>
            <telerik:RadGridView.RowStyle>
                <Style TargetType="telerik:GridViewRow">
                    <Setter Property="telerik:DragDropManager.AllowDrag"
                    Value="True" />
                    <Setter Property="telerik:DragDropManager.TouchDragTrigger"
                    Value="TapAndHold"/>
                    <Setter Property="IsExpandable" Value="True"/>
                    <Style.Triggers>
                        <DataTrigger Binding="{Binding Converter={StaticResource integerToBooleanConverter}, Path=SubList.Count}" Value="False">
                            <Setter Property="IsExpandable" Value="False"/>
                        </DataTrigger>
                    </Style.Triggers>
                </Style>
            </telerik:RadGridView.RowStyle>
            <telerik:RadGridView.Columns>
                <custom:NumberColumn Header="Nummber" Width="auto" ></custom:NumberColumn>
                <telerik:GridViewDataColumn DataMemberBinding="{Binding Name}" Header="Name" />
            </telerik:RadGridView.Columns>
            <telerik:RadGridView.ChildTableDefinitions>
                <telerik:GridViewTableDefinition />
            </telerik:RadGridView.ChildTableDefinitions>
            <telerik:RadGridView.HierarchyChildTemplate>
                <DataTemplate>
                    <telerik:RadGridView x:Name="SectionGrid" GroupRenderMode="Flat"
 GridLinesVisibility="None"                                  CanUserFreezeColumns="False"                                        AutoGenerateColumns="False"                                     ShowGroupPanel="False"  IsFilteringAllowed="False" ItemsSource="{Binding SubList}" AllowDrop="True"
            behavior:RowReorderBehavior.IsEnabled="True">
                        <telerik:RadGridView.Resources>
                            <DataTemplate x:Key="DraggedItemTemplate">
                                <StackPanel>
                                    <TextBlock Text="{Binding CurrentDraggedItem.Name}" FontWeight="Bold" />
                                </StackPanel>
                            </DataTemplate>
                            <converter:IntegerToBooleanConverter x:Key="integerToBooleanConverter"/>
                        </telerik:RadGridView.Resources>
                        <telerik:RadGridView.RowStyle>
                            <Style TargetType="telerik:GridViewRow">
                                <Setter Property="telerik:DragDropManager.AllowDrag" Value="True" />
                                <Setter Property="telerik:DragDropManager.TouchDragTrigger" Value="TapAndHold"/>
                                <Setter Property="IsExpandable" Value="True"/>
                                <Style.Triggers>
                                    <DataTrigger Binding="{Binding Converter={StaticResource integerToBooleanConverter}, Path=SubList.Count}" Value="False">
                                        <Setter Property="IsExpandable" Value="False"/>
                                    </DataTrigger>
                                </Style.Triggers>
                            </Style>
                        </telerik:RadGridView.RowStyle>
                        <telerik:RadGridView.Columns>
                            <telerik:GridViewDataColumn DataMemberBinding="{Binding Name}"
                                            Header="Name" />
                            <telerik:GridViewDataColumn DataMemberBinding="{Binding Size}"
                                            Header="Size(mm)" />
                            <telerik:GridViewDataColumn DataMemberBinding="{Binding SumSize}"
                                            Header="SumSize(mm)" />
                        </telerik:RadGridView.Columns>
                    </telerik:RadGridView>
                </DataTemplate>
            </telerik:RadGridView.HierarchyChildTemplate>
        </telerik:RadGridView>

0
Stefan
Telerik team
answered on 03 Feb 2016, 02:14 PM
Hi Wang,

Can you please clarify whether you are referring to the symbol appearing over a given element, to which the drop operation is disabled? If this is the case, please note, that if the AllowDrop property is correctly set to a given GridViewRow, this symbol would appear automatically. Basically, within the DragOver event handler, you can use the DataContext of a given GridViewRow to determine whether the item is from the child or the parent collection, thus set the AllowDrop property accordingly.

Best Regards,
Stefan X1
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Peter
Top achievements
Rank 1
answered on 11 Mar 2019, 01:33 PM

Hi Stefan,

I have a similar problem like Wang. I am developing a control which contains a GridView. Some of the items can have sub items which are assigned to another GridView which is the HierarchyChildTemplate of the main GridView.

How can I implement a drag and drop functionality between the main GridView and the child GridView and vice versa.

Thanks.

Beste regards

Peter

 

0
Vladimir Stoyanov
Telerik team
answered on 14 Mar 2019, 09:44 AM
Hello Peter,

I answered your question in the other forum thread that you have opened: DragDrop between GridView and child GridView in HierachyChildTemplate.

Regards,
Vladimir Stoyanov
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
GridView
Asked by
Wang
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Wang
Top achievements
Rank 1
Peter
Top achievements
Rank 1
Vladimir Stoyanov
Telerik team
Share this question
or