This question is locked. New answers and comments are not allowed.
Hi! can someone show me how to bind data in telerik treeview! what i am trying to do here is that, may data will come from WCF, and it is a list of records. I trying to do this
tmpQPSummary = e.Result;
trQPSummary.ItemsSource = tmpQPSummary.ToArray();
where e.result is a List<QuestionSummary> and QuestionSummary is a class containing the following field, QuestionTitle and QuestionDesciption
Even if i do it like this
tmpQPSummary = e.Result;
trQPSummary.ItemsSource = tmpQPSummary;
still doesnt work.
Thanks a lot...
4 Answers, 1 is accepted
0
Hello al,
Are you specifying data templates for the data you receive from your WCF service? If not, probably this is the problem because the items you put in the treeview are not RadTreeViewItems and the tree does not know how to display them. When binding to a collection of custom business objects (what you get from your WCF service) you need to let the treeview know how you want these business objects to be displayed by specifying data templates.
Let me know if you have further questions.
Greetings,
Tihomir Petkov
the Telerik team
Check out Telerik Trainer , the state of the art learning tool for Telerik products.
Are you specifying data templates for the data you receive from your WCF service? If not, probably this is the problem because the items you put in the treeview are not RadTreeViewItems and the tree does not know how to display them. When binding to a collection of custom business objects (what you get from your WCF service) you need to let the treeview know how you want these business objects to be displayed by specifying data templates.
Let me know if you have further questions.
Greetings,
Tihomir Petkov
the Telerik team
Check out Telerik Trainer , the state of the art learning tool for Telerik products.
0
al
Top achievements
Rank 1
answered on 02 Apr 2009, 03:00 AM
Thank you for your immediate response!
Can you show me how to make a data template programatically. Becuase all the examples that i have seen, they are all map in the xaml file. i want to map it programtically. can you help me with it, and show me how it is done.
thanks...
Can you show me how to make a data template programatically. Becuase all the examples that i have seen, they are all map in the xaml file. i want to map it programtically. can you help me with it, and show me how it is done.
thanks...
0
Hi al,
I would not recommend creating your data templates from the code-behind because it is not as elegant as the XAML alternative, takes more code, and is harder to maintain your code afterwards.
Anyways, I am attaching a sample project which demonstrates how to create and assign data templates programmatically.
Let me know if you have further questions.
Sincerely yours,
Tihomir Petkov
the Telerik team
Check out Telerik Trainer , the state of the art learning tool for Telerik products.
I would not recommend creating your data templates from the code-behind because it is not as elegant as the XAML alternative, takes more code, and is harder to maintain your code afterwards.
Anyways, I am attaching a sample project which demonstrates how to create and assign data templates programmatically.
Let me know if you have further questions.
Sincerely yours,
Tihomir Petkov
the Telerik team
Check out Telerik Trainer , the state of the art learning tool for Telerik products.
0
Hello al,
Oops, forgot the attachment.
Best wishes,
Tihomir Petkov
the Telerik team
Check out Telerik Trainer , the state of the art learning tool for Telerik products.
Oops, forgot the attachment.
Best wishes,
Tihomir Petkov
the Telerik team
Check out Telerik Trainer , the state of the art learning tool for Telerik products.