private void ButtonDecision_Click(object sender, RoutedEventArgs e) { NameValue info = ListBoxItem.SelectedItem as NameValue; if (info == null) { return; } ID = info.Value; Close(); }
private void Window_Loaded(object sender, RoutedEventArgs e) { CreateItemList(""); foreach (var item in ListBoxItem.Items) { NameValue info = item as NameValue; if (info.Value == ID) { ListBoxItem.SelectedItem = item; ListBoxItem.ScrollIntoView(item); break; } } }