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

[Solved] Error when rebinding the treeview

4 Answers 125 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
al
Top achievements
Rank 1
al asked on 26 Jun 2009, 10:08 AM
Hi everyone, i have a delema here!
I used wcf in populating the tree. during the first load, its ok. it loads all the data that i want to see, but when i click the nect button, ann error popup. "Operation not supported on read-only collection". below is my partial code.

tSummary.Items.Clear();

tSummary.ItemsSource =

new SummaryQuestionList(e, ref QuestionsMasteryScore);

so every time i clicked the next button, it will re populate the tree.

I have tried all posible ways to eliminate the error but no successfull.

pls help....

 

4 Answers, 1 is accepted

Sort by
0
Valentin.Stoychev
Telerik team
answered on 26 Jun 2009, 12:22 PM
Hello al,

Please check this thread - your problem looks similar:
http://www.telerik.com/community/forums/silverlight/treeview/operation-not-supported-on-read-only-collection.aspx

Regards,
Valentin.Stoychev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
al
Top achievements
Rank 1
answered on 29 Jun 2009, 03:33 AM
Hi! thanks for your reply. I have visited the thread, and i still get the same error...
what i did is i declare a global variable. then clear that one when repopulating the tree.

if

 

(tmpItemSource != null)

 

tmpItemSource.Clear();

tmpItemSource =

new SummaryQuestionList(e, ref QuestionsMasteryScore);

 

tSummary.ItemsSource = tmpItemSource;

error: Item collection must be empty before using ItemSource.

my data comes from wcf.

is there something that i missed?!

0
al
Top achievements
Rank 1
answered on 29 Jun 2009, 05:04 AM
Additional info: I used template for the treeview. The template are assiged in the xml file. they are not assigned during run time.

I also tried this one:

tSummary = new Treeview;

tSummary.ItemsSource = new SummaryQuestionList(e, ref QuestionsMasteryScore);

it works but there is no data.

 

0
al
Top achievements
Rank 1
answered on 29 Jun 2009, 06:26 AM
Hi! i have already solved the problem. In the xml file, theres a <TextBlock Text="{Binding Path=Name}"/>. I remove that one and it already works.

thanks...
Tags
TreeView
Asked by
al
Top achievements
Rank 1
Answers by
Valentin.Stoychev
Telerik team
al
Top achievements
Rank 1
Share this question
or