a simple xaml:
<ComboBox
Height="23" Name="status"
IsReadOnly="False"
ItemsSource="?"
Width="120">
</ComboBox>
What you need to write to С# that stick items in the drop-down list right here
a simple xaml:
<ComboBox
Height="23" Name="status"
IsReadOnly="False"
ItemsSource="?"
Width="120">
</ComboBox>
What you need to write to С# that stick items in the drop-down list right here
Your ItemsSource
is a simple binding to a collection of [something] that will fill out the combolist, here's a quick sample:
public class MyDataSource
{
public IEnumerable<string> ComboItems
{
get
{
return new string[] { "Test 1", "Test 2" };
}
}
}
<ComboBox
Height="23" Name="status"
IsReadOnly="False"
ItemsSource="{Binding Path=ComboItems}"
Width="120">
</ComboBox>
That's not a complete sample, but it gives you the idea.
It's also worth noting that you don't have to use the ItemsSource
property, this is also acceptable:
<ComboBox
Height="23" Name="status"
IsReadOnly="False"
Width="120">
<ComboBox.Items>
<ComboBoxItem>Test 1</ComboBoxItem>
<ComboBoxItem>Test 2</ComboBoxItem>
</ComboBox.Items>
</ComboBox>