private void ItemsStaticLocZTB_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == (char)Keys.Enter) { _ = ItemsListBox.Focus(); } }
private void ZoomableCanvas_Loaded(object sender, RoutedEventArgs e) { viewModel = (RepositoryViewModel)DataContext; viewModel.Canvas = (ZoomableCanvas)sender; viewModel.ListBox = ItemsListBox; ItemsListBox.Focus(); }
//****************************// private void GetDataButton_Click(object sender, EventArgs e) { this.UseWaitCursor = true; GetDataButton.Enabled = false; List <string> selectedSources = new List <string>(); foreach (var cb in FeedsListBox.CheckBoxItems) { if (cb.Checked) { selectedSources.Add(cb.Text); } } ItemsListBox.Items.Clear(); ItemsListBox.Items.Add("Select All"); foreach (string address in selectedSources) { try { string content = APIHelper.ExecuteRequest(address); XmlDocument xmlDoc = new XmlDocument(); xmlDoc.LoadXml(content); items = xmlDoc.GetElementsByTagName("item"); foreach (XmlNode item in items) { string title = item.SelectNodes("title")[0].InnerText; string description = item.SelectNodes("description")[0].InnerText; if (!feedItems.ContainsKey(title)) { feedItems.Add(title, description); } if (title.Length > 0) { ItemsListBox.Items.Add(title); } } ItemsListBox.Refresh(); //if (ItemsListBox.Items.Count > 0) // ItemsListBox.SelectedIndex = 0; } catch (Exception ex) { UpdateLog(ex.Message); } } this.UseWaitCursor = false; GetDataButton.Enabled = true; }
/// <summary> /// 清理所有正在使用的资源。 /// </summary> /// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param> protected override void Dispose(bool disposing) { toolStripDropDown?.Dispose(); toolStripControlHost?.Dispose(); ItemsListBox?.Dispose(); if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); }
private void OnItemMouseUp(object sender, MouseButtonEventArgs e) { if (((FrameworkElement)sender).DataContext is ContentInstallationEntry item && !ReferenceEquals(ItemsListBox.SelectedItem, item)) { var control = ItemsListBox.GetItemVisual(item); if (control != null) { var button = control.FindVisualChildren <Button>().FirstOrDefault(x => x.IsMouseOverElement()); button?.Command?.Execute(button.CommandParameter); } ItemsListBox.SelectedItem = item; } }
void LassoSelectionExample_Loaded(object sender, RoutedEventArgs e) { _dataSource = FindResource("DataSource") as StringCollection; for (int i = 0; i < 20; i++) { _dataSource.Add("Item - " + i); } OverlayInkCanvas.DefaultDrawingAttributes.Width = 10; OverlayInkCanvas.DefaultDrawingAttributes.Height = 10; OverlayInkCanvas.DefaultDrawingAttributes.Color = Colors.Red; ItemsListBox.Focus(); }
private void ItemsListBox_DoubleClick(object sender, EventArgs e) { QuantityNumericUpDown.ResetText(); TotalTextBox.Clear(); string itemName = ItemsListBox.GetItemText(ItemsListBox.SelectedItem); ItemNameTextBox.Text = itemName; try { DataTable Dtitemprice = GetAndSetItemAndPrice(itemName); DataRow row = Dtitemprice.Rows[0]; PriceTextBox.Text = row["price"].ToString(); } catch { } }
private void ItemsNoStaticLocRB_CheckedChanged(object sender, EventArgs e) { TextBox[] AllStaticLocTB = { ItemsStaticLocZoneTB, ItemsStaticLocXTB, ItemsStaticLocYTB, ItemsStaticLocZTB }; if ((ItemsListBox.SelectedIndex == -1) || (!(ItemsListBox.SelectedItem is QuestItem ThisItem))) { return; } if (ItemsNoStaticLocRB.Checked && (Program.itemList[ThisItem.DaybreakID].StaticLoc != 0)) { dirties[2] = true; StatusStripDirtyIndicator.Text = FloppyString; Program.itemList[ThisItem.DaybreakID].StaticLoc = 0; (ItemsListBox.SelectedItem as QuestItem).StaticLoc = 0; ItemsListBox.Refresh(); } else if (ItemsCorpseDropBool.Checked && (Program.itemList[ThisItem.DaybreakID].StaticLoc != QuestItem.ItemsStaticLocValues.ZoneSpec)) { dirties[2] = true; StatusStripDirtyIndicator.Text = FloppyString; Program.itemList[ThisItem.DaybreakID].StaticLoc = QuestItem.ItemsStaticLocValues.ZoneSpec; (ItemsListBox.SelectedItem as QuestItem).StaticLoc = QuestItem.ItemsStaticLocValues.ZoneSpec; ItemsListBox.Refresh(); } else if (ItemsStaticLocRB.Checked && (Program.itemList[ThisItem.DaybreakID].StaticLoc != QuestItem.ItemsStaticLocValues.FixedLoc)) { dirties[2] = true; StatusStripDirtyIndicator.Text = FloppyString; Program.itemList[ThisItem.DaybreakID].StaticLoc = QuestItem.ItemsStaticLocValues.FixedLoc; (ItemsListBox.SelectedItem as QuestItem).StaticLoc = QuestItem.ItemsStaticLocValues.FixedLoc; ItemsListBox.Refresh(); } if (ItemsNoStaticLocRB.Checked) { if (ItemsStaticLocRB.Checked) { ItemsStaticLocRB.Checked = false; } if (ItemsCorpseDropBool.Checked) { ItemsCorpseDropBool.Checked = false; } for (int counter = 0; counter < 4; counter++) { AllStaticLocTB[counter].Enabled = false; AllStaticLocTB[counter].Text = string.Empty; } } }
//****************************// private void ClearFeedButton_Click(object sender, EventArgs e) { ItemsListBox.CheckBoxCheckedChanged -= ItemsListBox_CheckBoxCheckedChanged; //FeedsListBox.ClearSelection(); //foreach (var cb in FeedsListBox.CheckBoxItems) //{ // cb.Checked = false; //} ItemsListBox.ClearSelection(); ItemsListBox.Items.Clear(); SourceDataBox.Text = ""; RandBox.Text = ""; ItemsListBox.CheckBoxCheckedChanged += ItemsListBox_CheckBoxCheckedChanged; }
private void ComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { ItemsListBox.GetBindingExpression(ItemsControl.ItemsSourceProperty).UpdateSource(); }
private void EndLassoSelection() { OverlayInkCanvas.Visibility = Visibility.Hidden; ItemsListBox.Focus(); }
public void SetFocus() { ItemsListBox.Focus(); }