Items collection must be empty before using ItemsSource

by Scott 9. March 2010 11:26

In silverlight or WPF if you get the error:

"Items collection must be empty before using ItemsSource"

make sure you aren't populating the control with both the ItemsSource and adding children to the control in XAML.  In my case, I was setting ItemsSource after a call to a WCF service.  I had mistakingly also added a placeholder object in my XAML until I had written the WCF call.  Oops. 

Hope this helps somebody,

Scott

Tags:

Silverlight

About the author

Hi, I'm Scott.  My company develops in C#/ASP.NET/Silverlight and and creates e-commerce web sites for small business.  Visit our corporate site, Gildner Solutions.  We are working on a brand new one now.

RecentComments

Comment RSS