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