Hello,
Does anyone know why I keep getting the "Items collection must be empty before using ItemsSource"-Error?
Here is the code:
<ScrollViewer Margin="8,8,8,8" Grid.Row="3" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Disabled">
<WrapPanel Orientation="Vertical">
<ItemsControl ItemsSource="{Binding}" x:Name="CustomerList" >>
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel Orientation="Horizontal">
</WrapPanel>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<View:UserControlCustomerDetails>
</View:UserControlCustomerDetails>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</WrapPanel>
</ScrollViewer>
This is what I do in my Code-Behind:
CustomerList.ItemsSource = _mainViewModel.CustomerCollection;
Note that CustomerCollection is just a simple List<Customers
>.
Thanks for your help!
Cheers