Based on this answer https://stackoverflow.com/a/33109026/426386 I add an empty Item to my ComboBox collection. As my Combobox has a SelectedValue and SelectedValuePath defined, I'll run into Bindingerrors:
<UserControl.Resources>
<ObjectDataProvider
x:Key="CardTypeProvider"
MethodName="GetLocalizedEnumValues"
ObjectType="{x:Type base:Localize}">
<ObjectDataProvider.MethodParameters>
<x:Type
TypeName="base:CardTypes" />
</ObjectDataProvider.MethodParameters>
</ObjectDataProvider>
</UserControl.Resources>
<ComboBox
DisplayMemberPath="Value"
SelectedValue="{Binding GroupByCardType, UpdateSourceTrigger=PropertyChanged}"
SelectedValuePath="Key">
<ComboBox.Resources>
<CollectionViewSource
x:Key="Items"
Source="{Binding Source={StaticResource CardTypeProvider}}" />
</ComboBox.Resources>
<ComboBox.ItemsSource>
<CompositeCollection>
<TextBlock />
<CollectionContainer
Collection="{Binding Source={StaticResource Items}}" />
</CompositeCollection>
</ComboBox.ItemsSource>
</ComboBox>
The ObjectDataProvider returns following Type:
Dictionary<Enum, string>
To avoid the Binding errors I want to instantiate a KeyValuePair<Enum, string>
instead of the TextBlock. Possible somehow?