嘿家伙/女孩。我有一个Silverlight 2应用程序,它有一个来自单独的组件/ lib的ObservableCollection类。当我在该集合上设置ListBox.ItemsSource并运行它时,出现错误代码:4004“System.ArgumentException:值不在预期范围内。” 下面是部分代码:Silverlight 2错误代码:4004
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;
}
}
但当我这个相同的项目中创建的主阶级,一切工作正常。 幕后有没有一些安全的事情发生?另外,当我创建此Silverlight 2应用程序时,我正在使用生成html页面选项而不是aspx选项。
是的,我将它创建为Silverlight类库。经过无数个小时搜索“Google”后,我放弃了。现在一切都在一个项目中。 – jkidv 2008-12-18 17:35:08