我有一个combobox
并且像这样被使用:
XAML
<ComboBox x:Name="cmbMarkOfWatch"
Grid.Column="0" Grid.Row="2"
Margin="1"
Width="230"
MaxHeight="20"
HorizontalAlignment="Left" />
C sharp
cmbMarkOfWatch.ItemsSource = obj.Clock.Select(w => w.mark).ToArray();
cmbMarkOfWatch.SelectedIndex = 0;
我想在All
的顶部添加一个静态值combobox
。
我怎么能这样做?
祝你好运
答案 0 :(得分:1)
尝试,
List<string> results = obj.Clock.Select(w => w.mark).ToList();
results.Insert(0, "All");
cmbMarkOfWatch.ItemsSource = resutls;
cmbMarkOfWatch.SelectedIndex = 0;