【发布时间】:2015-07-03 09:23:28
【问题描述】:
我需要在 silverlight 应用程序中的按钮单击事件中将项目从一个列表框移动到另一个列表框。
我使用下面的代码,
private void Button_Click_1(object sender, RoutedEventArgs e)
{
ListBox2.Items.Add(ListBox1.SelectedItem);
if (ListBox2.SelectedIndex != -1)
{
ListBox1.Items.Add(ListBox2.SelectedValue);
ListBox2.Items.Remove(ListBox2.SelectedValue);
}
}
但是如果我尝试使用上面的代码,它会给出以下错误,
operation not supported on read-only collection
如何解决这个问题??
【问题讨论】:
-
@Michay No .. 我没用过
-
@Michay OP 可能没有这样做,因为 WPF 或 Silverlight 中没有 DataSource 属性。问题不在于 WinForms。
标签: c# wpf silverlight listbox silverlight-4.0