In my Control I have a ListBox
. Each ListBoxItem is displayed (via ItemTemplate) as a Combobox
whose ItemsSource is an ObservableCollection in the ViewModel of my Control.
Next to that ComboBox is a Button to delete an element from the list (the Button's Click Command is bound to a Delete-Command in the ViewModel of my control). This works fine as desired.
Now I want to be able to add new elements to the ListBox. I'd know how to do this by clicking a Button either somewhere outside the ListBox or in the ListBox's ItemTemplate, but instead I would like to add some kind of additional "empty" item as the last item of my ListBox.
This "empty" item should look like any other item, with the exception that the ComboBox has no selection. As soon as the user makes a selection, a new "empty" item has to be displayed. I hope you know what I mean...acutally it's a bit like the "Tags" editor when you post a new question here ;)
Any ideas??? (without breaking MVVM rules)...