Silverlight中的只读集合不支持该操作 [英] Operation not supported on read-only collection in Silverlight

查看:121
本文介绍了Silverlight中的只读集合不支持该操作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我的应用程序中有一个组合框.数据正在从数据库填充到组合框中.在存储过程中,我已明确给出了全部".现在我在其他页面中还有另一个组合框,其中仅应从数据库中提取数据填充的不是全部".所以我所做的全部删除了,全部由

cmbFeedType.Items.Remove("ALL");

但它会抛出类似只读集合不支持该操作"的错误
任何人都可以帮忙..

谢谢,
Prasant

Hi All,

I have a Combobox in my Application.The Data is populating into the combo box from database.In the Stored Proc i have given "All" Explicetely.Now i have another combo box in other page in which only data fetching from the database should be populated not "All".So what i did is explecetely removed All by

cmbFeedType.Items.Remove("ALL");

but its throwing an error like "Operation not supported on read-only collection"
can anyone help on this please..

Thanks,
Prasant

推荐答案

我假设您已经设置了ComboBox的ItemsSource.
设置ItemsSource后,您将无法修改Items集合,而必须修改ItemsSource设置为的集合.

同样,如果您已向Items集合中添加了任何项目,则无法设置ItemsSource.
I assume you''ve set the ComboBox''s ItemsSource.
When you''ve set the ItemsSource you cannot modify the Items collection, you''ll have to modify the collection your ItemsSource is set to.

Also the other way around if you''ve added any items to the Items collection then you cannot set the ItemsSource.


尝试在将数据集"All"绑定到组合框之前将其删除.
Try removing "All" from the dataset BEFORE binding it to the combobox.


这篇关于Silverlight中的只读集合不支持该操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆