I am trying to bind a list of strings to my combo box. But when I add a new item to the list or read items from the file, I receive Exception that Items collection must be empty before using ItemsSource. Remember that I need to put a button at the end of the Combobox. what can be the issue?
my Xaml code
<ComboBox Grid.Column="1" Text="Category">
<ComboBox.ItemsSource>
<CompositeCollection>
<CollectionContainer Collection="{Binding Categories}" />
<ComboBoxItem>
<Button Style="{StaticResource styleTextButton}"
Content="New Category"
Command="{Binding AddNewCategoryCommand}"
Width="235"/>
</ComboBoxItem>
</CompositeCollection>
</ComboBox.ItemsSource>
</ComboBox>
I have read “Items collection must be empty before using ItemsSource.” but it did not help me to solve the problem.