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

Radtreeview self referencing

9 Answers 113 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
macky
Top achievements
Rank 1
macky asked on 26 Apr 2011, 07:37 PM
Hi Telerik Staff,

         I just copy the codes using C#  and it doesn't compile. And I copied it on your  help website : http://www.telerik.com/help/wpf/radtreeview-how-to-bind-to-self-referencing-data.html.

       Please send me  a project  on this.  I hope you will send a zip file for me.

Thanks,
Mac

9 Answers, 1 is accepted

Sort by
0
Petar Mladenov
Telerik team
answered on 28 Apr 2011, 12:28 PM
Hello macky,

 I see that you've opened a forum thread for RadTreeView for Silverlight but you have pasted a link from WPF documentation. Here is the SL`s documentation link. I can thought of at least one difference in the code snippets ( HierarchicalDatatemplate in WPF ==> telerik:HierarchicalDataTemplate in SL). Let us know if this helps you.s

Greetings,
Petar Mladenov
the Telerik team
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 Public Issue Tracking system and vote to affect the priority of the items
0
Vincent
Top achievements
Rank 1
answered on 14 May 2011, 12:35 PM
Hi!! Do you have a complete code for this?? When I copy the code.. they have errors.... thanks... :)
0
Vincent
Top achievements
Rank 1
answered on 14 May 2011, 01:09 PM
it says that local hierarchyconverter does not exist... 
0
Petar Mladenov
Telerik team
answered on 18 May 2011, 02:37 PM
Hi Vincent,

Probably because your converter class has not been build successfully, have you added System.Linq namespace necessary for the "Where" extension methods? I am attaching a working example created by following the help article. Let us know if this helped you.

Best wishes,
Petar Mladenov
the Telerik team
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 Public Issue Tracking system and vote to affect the priority of the items
0
Vincent
Top achievements
Rank 1
answered on 18 May 2011, 02:42 PM
Thanks Telerik! I got it now!
0
Vincent
Top achievements
Rank 1
answered on 20 May 2011, 04:07 PM
HI! Thank you! I know now the correct code...
But I have some concern.. in your textblock, when I select an item from the treeview, it binds the value. Do you know how to bind the ITEM ID and the Parent ID when I select an item in the treeview?
0
Petar Mladenov
Telerik team
answered on 20 May 2011, 06:09 PM
Hello Vincent,

You can do something like so;
<Grid.Resources>
         <local:HierarchyConverter x:Key="HierarchyConverter" />
         <telerik:HierarchicalDataTemplate x:Key="ItemTemplate" 
                                           ItemsSource="{Binding Converter={StaticResource HierarchyConverter}}">
             <StackPanel Orientation="Horizontal">
                 <TextBlock Text="{Binding Text}" />
                 <Rectangle Fill="DeepSkyBlue" Height="18" VerticalAlignment="Center" Width="2" />
                 <TextBlock Text="parent ID: " Foreground="Blue"/>
                 <TextBlock Text="{Binding ParentId}" />
                 <Rectangle Fill="DeepSkyBlue" Height="18" VerticalAlignment="Center" Width="2" />
                 <TextBlock Text="Id: " Foreground="Blue" />
                 <TextBlock Text="{Binding Id}" />
             </StackPanel>
         </telerik:HierarchicalDataTemplate>
     </Grid.Resources>
Please let us know if this is what you need.

Best wishes,
Petar Mladenov
the Telerik team
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 Public Issue Tracking system and vote to affect the priority of the items
0
Angeli
Top achievements
Rank 1
answered on 28 May 2011, 04:30 PM
Hi Petar. How do I update the Text as well as the Parent ID when I add/remove/edit an item through a RadContextMenu?
0
Petar Mladenov
Telerik team
answered on 01 Jun 2011, 03:49 PM
Hi Angeli,

You first have to access the RadTreeViewItem  clicked with the mouse right button when the ContextMenuOpens:
private void ContextMenuOpened(object sender, RoutedEventArgs e)
        {
            RadTreeViewItem treeViewItem = (sender as RadContextMenu).GetClickedElement<RadTreeViewItem>();
You can see this realized in this demo. Then you probably need a twoway binding to a ViewModel ( if you want the visual changes to reflect the data behind). Let us know if you need further assistance on this.

Kind regards,
Petar Mladenov
the Telerik team
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 Public Issue Tracking system and vote to affect the priority of the items
Tags
TreeView
Asked by
macky
Top achievements
Rank 1
Answers by
Petar Mladenov
Telerik team
Vincent
Top achievements
Rank 1
Angeli
Top achievements
Rank 1
Share this question
or