tags:

views:

372

answers:

2

I've said it before and I'll say it again, the easiest examples for WPF are also the hardest to find on the web :)

I have a combo box that I need to display but it doesn't need to be databound or anything else, the content is static. How can I add a static list of items to my combo box using XAML?

+2  A: 

Like this:

<ComboBox Text="MyCombo">
<ComboBoxItem  Name="cbi1">Item1</ComboBoxItem>
<ComboBoxItem  Name="cbi2">Item2</ComboBoxItem>
<ComboBoxItem  Name="cbi3">Item3</ComboBoxItem>
</ComboBox>
Tony
I appreciate it.
Jim Beam
+2  A: 

Here is the code from MSDN and the link - Article Link, which you should check out for more detail.

<ComboBox Text="Is not open">
    <ComboBoxItem Name="cbi1">Item1</ComboBoxItem>
    <ComboBoxItem Name="cbi2">Item2</ComboBoxItem>
    <ComboBoxItem Name="cbi3">Item3</ComboBoxItem>
</ComboBox>
Wade73
I appreciate it.
Jim Beam
No problem. Let me know if you have any other WPF questions.
Wade73