【发布时间】:2015-08-02 12:46:50
【问题描述】:
我有ComboBox 与我的collection 绑定,现在我想在绑定之前添加另一个Item:"Please select..."
所以我试试这个:
combobox.Items.Add("Please select");
但是因为我有这个叮当声:
public ObservableCollection<MyData> collection { get; set; }
ItemsSource="{Binding collection}"
我收到的只是这个错误:
Items 集合在使用 ItemsSource 之前必须为空
那我该如何解决呢?
【问题讨论】:
-
你用谷歌搜索了吗?您的问题有很多可能的解决方案。
-
看看this answer。