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

About data binding of treelistView.

4 Answers 77 Views
TreeListView
This is a migrated thread and some comments may be shown as answers.
Neil Chow
Top achievements
Rank 1
Neil Chow asked on 02 Nov 2011, 11:28 PM
http://www.telerik.com/help/silverlight/radtreeliestview-getting-started.html

I don't know why, but this example doesn't work, no error, no data show.
Is there some trick to run this sample?

Best regards

_Sam

4 Answers, 1 is accepted

Sort by
0
XamlFish
Top achievements
Rank 1
answered on 05 Jun 2013, 10:25 PM
Hi there,
This is a pretty old post and has no response.  But the Getting Started example for the RadTreeListView STILL doesn't work.  I just copied it into a VS 2012 with the latest RadControls and it completely fails silently.  No errors, no data, as my fellow poster says.  Now, I'm new to binding and Silverlight, but I do know how to type....Can someone please help?  Is the problem that there is no instance of the source or DataContext?

Also, this isn't the only time that I've run into problems like this with Telerik documentation.  If you guys are looking for help along those lines, I'm available for hire!  :-)

Best,
Betty

Issue:  RadTreeListView Getting Started Example Doesn't work - http://www.telerik.com/help/silverlight/radtreeliestview-getting-started.html
0
Yoan
Telerik team
answered on 06 Jun 2013, 10:14 AM
Hello Betty,

I have prepared a sample project based on the mentioned help article and everything works as expected. Please find it attached. 


Regards,
Yoan
Telerik

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
XamlFish
Top achievements
Rank 1
answered on 06 Jun 2013, 09:37 PM
Thanks for the quick response back!  Once piece I was missing was the ItemSource statement in the Mainpage.cs.  However, the Items collection isn't displaying and I can't figure out what's missing.  Can you help?  See the attached picture.

Thanks.
0
Yoan
Telerik team
answered on 10 Jun 2013, 11:21 AM
Hello Betty,

By default the RadTreeListView will auto-generate the columns for your data, by creating a column for each property. In order to prevent this you have to set the AutogenerateColumns property to False and to manually add the desired columns to the Columns collection of the control. Please check the following code snippet for a reference:

<telerik:RadTreeListView x:Name="radTreeListView"
                         AutoGenerateColumns="False">
         <telerik:RadTreeListView.ChildTableDefinitions>
             <telerik:TreeListViewTableDefinition ItemsSource="{Binding Items}" />
         </telerik:RadTreeListView.ChildTableDefinitions>
         <telerik:RadTreeListView.Columns>
             <telerik:GridViewDataColumn DataMemberBinding="{Binding Name}"
                                 Header="Name" />
             <telerik:GridViewDataColumn DataMemberBinding="{Binding Count}"
                                 Header="Count" />
         </telerik:RadTreeListView.Columns>
     </telerik:RadTreeListView>

Please give it a try and let me know how it goes.


Regards,
Yoan
Telerik

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
TreeListView
Asked by
Neil Chow
Top achievements
Rank 1
Answers by
XamlFish
Top achievements
Rank 1
Yoan
Telerik team
Share this question
or