Thursday, December 30, 2010

Silverlight Programming : “Operation not supported on read-only collection”

Recently when I was trying to bind data to a Combo box conditionally I got this message saying "Operation not supported on read-only collection". Though I am clearing items in the collection and binding the ItemsSource I got this error. So I have set ItemSource to null before I clear the items. It worked well for me. Here is the sample snippet for doing this.

CarrierAccountDropDownList.ItemsSource = null;
CarrierAccountDropDownList.Items.Clear();
CarrierAccountDropDownList.ItemsSource = e.Result;
Happy Coding Coffee cup

No comments:

Post a Comment