WPF/C# - '绑定列表<string>到组合框

Dav*_*vid 3 c# wpf xaml combobox list

我希望我的组合框项目名称和值可以从我的列表中获取当然我不希望我的视图模型保存组合框项目列表.

我有一个清单a,b,c,d

public List<String> ComboList { get; set; }
Run Code Online (Sandbox Code Playgroud)

...

ComboList = new List<String>();
ComboList.Add("A");
ComboList.Add("B");
ComboList.Add("C");
ComboList.Add("D");
Run Code Online (Sandbox Code Playgroud)

和我的ComboBox

<ComboBox Margin="29,40,0,526" Width="212" Height="35" Grid.Row="1" ItemsSource="{Binding Path=ComboList, Mode=OneTime}" SelectedValuePath="Key" DisplayMemberPath="Value"></ComboBox>

但它给了我一个空的ComboBox ......

在此输入图像描述

sco*_*kel 5

删除SelectedValuePathDisplayMemberPath属性.他们错了.