Meine ComboBox
Artikel so etwas wie sein müssen:ComboBox ItemTemplate arbeitet nicht mit KeyValuePair
"Some Text 10.00 Andere Text 1.00"
ich den Code unten versucht, aber es funktioniert nicht. Es löst eine Ausnahme aus.
System.NullReferenceException wurde nicht behandelt Nachricht: Eine nicht behandelte Ausnahme des Typs 'System.NullReferenceException' in WindowsBase.dll
MyKeyValuePairArray
List<KeyValuePair<decimal, decimal>>
<ComboBox ItemsSource="{Binding Source={x:Static static:MyApp.MyKeyValuePairArray}}">
<ComboBox.ItemTemplate>
<DataTemplate>
<TextBlock>
<Run Text="Some Text" />
<Run Text="{Binding Path=Key}" />
<Run Text="Other Text" />
<Run Text="{Binding Path=Value}" />
</TextBlock>
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
die funktioniert, ist aufgetreten, aber Ich brauche die obige Vorlage:
<ComboBox ItemsSource="{Binding Source={x:Static static:MyApp.MyKeyValuePairArray}}"
DisplayMemberPath="Value"
SelectedValuePath="Key"/>