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

RowReorderBehavior in hierarchical-gridview

1 Answer 70 Views
GridView
This is a migrated thread and some comments may be shown as answers.
JKattestaart
Top achievements
Rank 1
JKattestaart asked on 14 Feb 2018, 09:02 AM

Hi,

I'm trying to apply the RowReorderBehavior (example xaml-sdk) in a hierarchical-gridview and wondering how to enable to childgrid for drah-and-drop.

 <controls:GridView
          x:Name="GridView"
          ItemsSource="{Binding Items}">
          <telerik:RadGridView.ChildTableDefinitions>
            <telerik:GridViewTableDefinition />
          </telerik:RadGridView.ChildTableDefinitions>
          <telerik:RadGridView.HierarchyChildTemplate>
            <DataTemplate>
              <controls:GridView
                x:Name="ChildGrid"
                AllowDrop="True"
                Drop="UIElement_OnDrop"
                ItemsSource="{Binding InvoiceLines}"
                RowIndicatorVisibility="Visible"
                SelectedItem="{Binding CurrentChild, Mode=TwoWay}">
                <controls:GridView.Resources>
                  <DataTemplate x:Key="DraggedItemTemplate">
                    <StackPanel>
                      <StackPanel Orientation="Horizontal">
                        <TextBlock Text="Dragging:" />
                        <TextBlock FontWeight="Bold" Text="{Binding CurrentDraggedItem}" />
                      </StackPanel>
                      <StackPanel Orientation="Horizontal">
                        <TextBlock
                          MinWidth="45"
                          FontWeight="Bold"
                          Text="{Binding CurrentDropPosition}" />
                        <TextBlock Foreground="Gray" Text=", (" />
                        <TextBlock Text="{Binding CurrentDraggedOverItem}" />
                        <TextBlock Foreground="Gray" Text=")" />
                      </StackPanel>
                    </StackPanel>
                  </DataTemplate>
                </controls:GridView.Resources>
                <controls:GridView.RowStyle>
                  <Style TargetType="telerik:GridViewRow">
                    <Setter Property="telerik:DragDropManager.AllowDrag" Value="True" />
                    <Setter Property="telerik:DragDropManager.TouchDragTrigger" Value="TapAndHold" />
                  </Style>
                </controls:GridView.RowStyle>

 

in the code behind is want to enable the childgrid like: RowReorderBehavior.SetIsEnabled(childgrid, isEnabled);

My problem is how to find the dependencyobject for the childgrid. Trying something like this...

this.GridView.HierarchyChildTemplate.FindName("ChildGrid", ????)

1 Answer, 1 is accepted

Sort by
0
JKattestaart
Top achievements
Rank 1
answered on 15 Feb 2018, 08:30 AM

Found it. use xaml like

local:RowReorderBehavior.IsEnabled="True"

Tags
GridView
Asked by
JKattestaart
Top achievements
Rank 1
Answers by
JKattestaart
Top achievements
Rank 1
Share this question
or