private void ChoicesButton_Click(object sender, RoutedEventArgs e)
{
ChoicesListBox.Tag = (sender as Button).Name;
List<string> choices;
switch ((sender as Button).Name)
{
case "TravelDirection2":
choices = travelDirectionChoices;
break;
case "AttributeParameter2":
choices = attributeParameterChoices;
break;
case "RestrictUTurns2":
choices = restrictUTurnChoices;
break;
case "OutputLines2":
choices = outputLineChoices;
break;
case "OutputGeometryPrecisionUnits2":
choices = outputGeomPrecisionChoices;
break;
case "DirectionsLengthUnits2":
choices = directionsLengthUnitChoices;
break;
default:
return;
}
ChoicesListBox.SelectionChanged -= ChoicesListBox_SelectionChanged;
ChoicesListBox.ItemsSource = choices;
int selectedIndex = choices.IndexOf((sender as Button).Content.ToString());
ChoicesListBox.SelectedIndex = selectedIndex;
ChoicesListBox.SelectionChanged += ChoicesListBox_SelectionChanged;
ChoicesPage.IsOpen = true;
}