I have something like a form where the user can assign a cutomer to a vehicle. But this is optional. The customers are in a combobox. I need a way to make sure that the user can choose 'none' if the combobox is open.
if have found something like this:
<ComboBox.ItemsSource>
<CompositeCollection>
<ComboBoxItem IsEnabled="False" Foreground="Black">none</ComboBoxItem>
<CollectionContainer Collection="{Binding Source={StaticResource DataKey}}" />
</CompositeCollection>
</ComboBox.ItemsSource>
But the Binding to the Collection doesn't work for me.
My form is an userControl which is included in a WPF-Window. The DataContext is on a Grid in the Window. Therefore, I have tried:
<CollectionContainer Collection="{Binding Customers, Source={RelativeSource AncestorType=Grid}}" />
But the comboBox only shows 'none'. How can I solve my problem?
Thanks in advance!