Hi,
I have what might be an unusual requirement. I'm trying to tie together the RadTreeView and RadGridView so that the grid appears as a node in the tree. Seems like it should be possible, and I've gotten part way through. See the attachment for a visual. I have the grid appearing by setting the ItemContainerStyle of a RadTreeViewItem. See below for the code.
Now to the question. I want to be able to drag items from the grid to another component on the form (not shown in screenshot). How to do that? The examples I've seen so far rely on .cs code to register the event handlers
ie RadDragAndDropManager.AddDragInfoHandler(wishlistView, OnWishListDragInfo);
In my case, the grid is created on the fly by the Tree. So, I think I probably need to set up the event handling declaratively. Is that true, and can anyone help me with an example?
Thanks.
Here's the xaml for the tree
<telerikNavigation:RadTreeView IsDragDropEnabled="False">
<telerikNavigation:RadTreeViewItem Header="Groups" ItemContainerStyle="{StaticResource TreeViewItemStyle}">
<telerikNavigation:RadTreeViewItem/> <!-- placeholder item. This expands into a grid because of the ItemContainerStyle specified in the parent -->
</telerikNavigation:RadTreeViewItem>
<telerikNavigation:RadTreeViewItem Header="Elements">
<telerikNavigation:RadTreeViewItem Header="Group1"/>
<telerikNavigation:RadTreeViewItem Header="Group2"/>
<telerikNavigation:RadTreeViewItem Header="Group3"/>
</telerikNavigation:RadTreeViewItem>
<telerikNavigation:RadTreeViewItem Header="Item3"/>
<telerikNavigation:RadTreeViewItem Header="Item4"/>
<telerikNavigation:RadTreeViewItem Header="Item6"/>
</telerikNavigation:RadTreeView>
And here's the style set as the ItemContainerStyle
<Style TargetType="telerikNavigation:RadTreeViewItem" x:Key="TreeViewItemStyle">
<Setter Property="Template" Value="{StaticResource xxtemplate}" />
<Setter Property="IsExpanded" Value="True"></Setter>
<Setter Property="ItemsPanel">
<Setter.Value>
<ItemsPanelTemplate>
<StackPanel HorizontalAlignment="Center" Margin="4,6"
Orientation="Horizontal" />
</ItemsPanelTemplate>
</Setter.Value>
</Setter>
</Style>
I have what might be an unusual requirement. I'm trying to tie together the RadTreeView and RadGridView so that the grid appears as a node in the tree. Seems like it should be possible, and I've gotten part way through. See the attachment for a visual. I have the grid appearing by setting the ItemContainerStyle of a RadTreeViewItem. See below for the code.
Now to the question. I want to be able to drag items from the grid to another component on the form (not shown in screenshot). How to do that? The examples I've seen so far rely on .cs code to register the event handlers
ie RadDragAndDropManager.AddDragInfoHandler(wishlistView, OnWishListDragInfo);
In my case, the grid is created on the fly by the Tree. So, I think I probably need to set up the event handling declaratively. Is that true, and can anyone help me with an example?
Thanks.
Here's the xaml for the tree
<telerikNavigation:RadTreeView IsDragDropEnabled="False">
<telerikNavigation:RadTreeViewItem Header="Groups" ItemContainerStyle="{StaticResource TreeViewItemStyle}">
<telerikNavigation:RadTreeViewItem/> <!-- placeholder item. This expands into a grid because of the ItemContainerStyle specified in the parent -->
</telerikNavigation:RadTreeViewItem>
<telerikNavigation:RadTreeViewItem Header="Elements">
<telerikNavigation:RadTreeViewItem Header="Group1"/>
<telerikNavigation:RadTreeViewItem Header="Group2"/>
<telerikNavigation:RadTreeViewItem Header="Group3"/>
</telerikNavigation:RadTreeViewItem>
<telerikNavigation:RadTreeViewItem Header="Item3"/>
<telerikNavigation:RadTreeViewItem Header="Item4"/>
<telerikNavigation:RadTreeViewItem Header="Item6"/>
</telerikNavigation:RadTreeView>
And here's the style set as the ItemContainerStyle
<Style TargetType="telerikNavigation:RadTreeViewItem" x:Key="TreeViewItemStyle">
<Setter Property="Template" Value="{StaticResource xxtemplate}" />
<Setter Property="IsExpanded" Value="True"></Setter>
<Setter Property="ItemsPanel">
<Setter.Value>
<ItemsPanelTemplate>
<StackPanel HorizontalAlignment="Center" Margin="4,6"
Orientation="Horizontal" />
</ItemsPanelTemplate>
</Setter.Value>
</Setter>
</Style>