private void SetTextBoxes() { IdTextBox.Text = IdListBox.GetItemText(IdListBox.SelectedItem); CategoryTextBox.Text = CategoryListBox.GetItemText(CategoryListBox.SelectedItem); NameTextBox.Text = NameListBox.GetItemText(NameListBox.SelectedItem); PriceTextBox.Text = PriceListBox.GetItemText(PriceListBox.SelectedItem); }
private void Window_ContentRendered(object sender, EventArgs e) { if (IdListBox.Items.Count > 0) { for (int i = 0; i < IdListBox.Items.Count; i++) { string movieid = IdListBox.Items[i].ToString(); if (movieid.ToLower() == ID.ToLower()) { IdListBox.SelectedItem = IdListBox.Items[i]; IdListBox.ScrollIntoView(IdListBox.Items[i]); break; } } } }
private void SearchTextBox_KeyDown(object sender, KeyEventArgs e) { if (e.Key == Key.Enter) { TextBox tb = sender as TextBox; string result = Identify.SearchSimilarityAnalysis(tb.Text, vieModel.MovieIDList.ToList()); //相似度分析 if (result != "") { for (int i = 0; i <= IdListBox.Items.Count - 1; i++) { if (IdListBox.Items[i].ToString().ToUpper() == result.ToUpper()) { IdListBox.SelectedItem = IdListBox.Items[i]; IdListBox.ScrollIntoView(IdListBox.Items[i]); break; } } } } }