Hi guys. I have a silverlight 2 application that has an ObservableCollection of a class from a separate / lib assembly. When I set my ListBox.ItemsSource in this collection and run it, I get the error code: 4004 "System.ArgumentException: value is not in the expected range". Here is the piece of code:
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; } }
But when I create the Owner class in the same project, everything works fine. Are there some safety things happening behind the scenes? Also, I use the html page generation option, not the aspx option, when I created this Silverlight 2 application.
jkidv source share