I have this combobox in XAML:
<ComboBox x:Name="Tempos"
HorizontalAlignment="Left"
Height="55"
Margin="90,216,0,0"
VerticalAlignment="Top"
Width="205" SelectionChanged="Tempos_SelectionChanged" >
<ComboBoxItem Content="2/4" />
<ComboBoxItem Content="3/4" />
<ComboBoxItem Content="4/4" />
<ComboBoxItem Content="5/4" />
<ComboBoxItem Content="6/4" />
<ComboBoxItem Content="7/4" />
</ComboBox>
And in C # I have this method:
private void Tempos_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
resultado.text= Tempos.SelectedIndex.ToString();
}
I am occupying selectedindex
but that is useful if you always know the order, but if the order of the fields in my ComboBox
is dynamic, how do I identify them?