tags:

views:

15

answers:

2

I have a compbobox with the following information

<ComboBox 
   Margin="10,10,0,13" Name="ComboBox1" HorizontalAlignment="Left" 
   VerticalAlignment="Top" Width="128" Height="21"> 
   <ComboBoxItem Content="All " ></ComboBoxItem> 
   <ComboBoxItem Content="Printed"></ComboBoxItem> 
   <ComboBoxItem Content="Unprinted"></ComboBoxItem> 
</ComboBox>

I want to also add the selected value for all being 2 printed being 1 and unprinted being 0 is there a way to add it in the xaml?

A: 

I think I found the answer






Selected Value will then work because it will retrieve whatever is in Tag of the selected item.

Spafa9
you need to indent code 4 spaces if you want it to be displayed.
Val
+1  A: 

If you reversed the order of your ComboBoxItem declarations, then the property SelectedIndex on the ComboBox would yield these results.

Though its not a very scalable solution. You might want to try creating a collection of enumerated types and then binding that to the ItemsSource of the ComboBox and then investigating the SelectedItem to see which item has been selected.

Hope it helps.

Val