我有一个 silverlight 2 应用程序,它有一个来自单独的 assem/lib 的类的 ObservableCollection。当我在该集合上设置 ListBox.ItemsSource 并运行它时,我收到错误代码:
4004 “System.ArgumentException:值不在预期范围内。”
以下是部分代码:
public partial class Page : UserControl
{
ObservableCollection<Some.Lib.Owner> ooc;
public Page()
{
ooc = new ObservableCollection<Some.Lib.Owner>();
Some.Lib.Owner o1 = new Some.Lib.Owner() { FirstName = "test1" };
Some.Lib.Owner o2 = new Some.Lib.Owner() { FirstName = "test2" };
Some.Lib.Owner o3 = new Some.Lib.Owner() { FirstName = "test3" };
ooc.Add(o1);
ooc.Add(o2);
ooc.Add(o3);
InitializeComponent();
lb1.ItemsSource = ooc;
}
}
但是当我在同一个项目中创建 Owner 类时,一切正常。幕后是否有一些安全问题?此外,当我创建此 Silverlight 2 应用程序时,我使用的是生成 html 页面选项而不是 aspx 选项。