I'm dynamically populating a silverlight listbox, programmatically, with a template control. the listbox is empty, and when i attempt a listBox.Items.Add(myTemplateControl), it throws the "Value does not fall within the expected range" argumentexception.
i verified in the debugger that the item collection is indeed emtpy. the only time i've heard of this exception happening is when the list already contains an instance with that name.
any thoughts?
Stack trace:
at MS.Internal.XcpImports.MethodEx(IntPtr ptr, String name, CValue[] cvData) at MS.Internal.XcpImports.MethodPack(IntPtr objectPtr, String methodName, Object[] rawData) at MS.Internal.XcpImports.Collection_Add[T](PresentationFrameworkCollection`1 collection, Object value) at System.Windows.PresentationFrameworkCollection`1.AddImpl(Object value) at System.Windows.Controls.ItemCollection.AddImpl(Object value) at System.Windows.Controls.ItemCollection.AddInternal(Object value) at System.Windows.PresentationFrameworkCollection`1.Add(T value) at KTClientRIA.Documents.b__4(Object sender, DownloadStringCompletedEventArgs e) at System.Net.WebClient.OnDownloadStringCompleted(DownloadStringCompletedEventArgs e)
MS.Internal.XcpImports.MethodEx- SLaks