I've got a newbie question about the combo box. The problem I'm having is with the selection changed event I'm binding to it. Here is my Code:
<ComboBox Height="23"
HorizontalAlignment="Left"
Margin="12,67,0,0"
Name="comboBox1"
VerticalAlignment="Top"
Width="112"
SelectionChanged="comboBox1_SelectionChanged">
<ComboBoxItem Content="Pokey"
IsSelected="True" />
<ComboBoxItem Content="Octo-ooze" />
<ComboBoxItem Content="Bolt" />
<ComboBoxItem Content="Fink" />
</ComboBox>
And in the code behind:
private void comboBox1_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
switch (comboBox1.Text)
{
case "Pokey" :
tbMinutes.Text = "0";
tbSeconds.Text = "8";
break;
case "Octo-ooze":
tbMinutes.Text = "0";
tbSeconds.Text = "16";
break;
case "Bolt":
tbMinutes.Text = "0";
tbSeconds.Text = "23";
break;
case "Fink":
tbMinutes.Text = "1";
tbSeconds.Text = "40";
break;
}
}
Whats happening is tbMinutes.Text and tbSeconds.Text uses the old values, so for example if the combo box is initially Pokey and I change it to Bolt, it will still use the Pokey values as if its lagging one step behind.