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