Dear All,
I started using radtreeview to develop a treeview for first trial.
I am facing a problem with the dragdrop manager, which I belevie with the HierarchicalDataTemplate of my treeview.
The HierarchicalDataTemplate contain a self-reference parent-to-child on the same table as follows:
<telerik:HierarchicalDataTemplate x:Key="ListTemplate"
ItemsSource="{Binding Path=Children, Mode=TwoWay}">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<TextBlock x:Name="Label" Text="{Binding name}" Grid.Column="1" VerticalAlignment="Center"/>
<StackPanel Orientation="Horizontal" Grid.Column="2" VerticalAlignment="Center">
<TextBlock Text=" (" />
<TextBlock Text="{Binding order}" FontSize="10"/>
<TextBlock Text=")"/>
</StackPanel>
</Grid>
</telerik:HierarchicalDataTemplate>
<telerik:HierarchicalDataTemplate x:Key="BigSiteTemplate"
ItemsSource="{Binding Path=GroupList, Mode=TwoWay}"
ItemTemplate="{StaticResource ListTemplate}">
<StackPanel Orientation="Horizontal" VerticalAlignment="Center">
<TextBlock Text="{Binding Title}" Foreground="Blue" FontWeight="Bold" FontSize="10"/>
</StackPanel>
</telerik:HierarchicalDataTemplate>
and my treeview is binded to an observable collection of <User> as follows:
<telerik:RadTreeView x:Name="TOU" FontSize="10" Grid.Row="1"
IsLineEnabled ="True" IsTextSearchEnabled="True" IsEditable="True" IsVirtualizing="True"
ItemTemplate="{StaticResource BigSiteTemplate}"
SelectedItem="{Binding ItemSelected,Mode=TwoWay}"
IsDragDropEnabled="True"
ItemsSource="{Binding Items,Mode=TwoWay}"
>
</telerik:RadTreeView>
this observable collection is fully populated with the items from the database with no problem.
Everything is worinking except for the drag&drop which is only can be done at the first level not on the children
let me show you the code I have to populate the Items (tree datasource), because I have done something extra.
IEnumerable<User> g = await DataService.GetUserGroupsAsync(1);
var t = new ObservableCollection<User>();
foreach (User entity in g)
{
t.Add(entity);
}
tems = new ObservableCollection<GroupLists>();
GroupLists newList = new GroupLists() { Id = "0", Title = "Root", IsExpanded = true };
Items.Add(newList);
Items[0].GroupList = t;
Here I am wrapping the GroupList inside a class to add a root level for my displayed items...
does anyone has an explanation for that ....