private void ActionButton_OnClick(object sender, RoutedEventArgs e) { ActionButtonClick?.Invoke(sender, e); if (KeepOpenWhenSelecting) { this.textbox.Focus(); } this.actionButton.ShowOnlyIf(this.controller.ShowActionButton && !ActionButtonText.IsNullOrEmpty()); }
private void ensureList() { if (!this.needsToRefreshList) { return; } using (Performance.Measure("building auto complete list {0}", this.controller.DebugIdentifier)) { this.controller.FillList(this.listBox); this.actionButton.ShowOnlyIf(this.controller.ShowActionButton && !ActionButtonText.IsNullOrEmpty()); } this.needsToRefreshList = false; }
private void open(bool closeIfEmpty = false, bool showAll = false) { if (!showAll && this.textbox.Text == "" && !this.popup.IsOpen) { return; } if (!this.popup.IsOpen) { this.updateTarget(); } // fix to make sure list updates layout when first opened this.popup.IsOpen = true; if (!KeepOpenWhenSelecting) { // Reset listbox scroll position if (this.listBox.SelectedIndex != -1) { this.listBox.SelectedIndex = -1; this.listBox.UpdateLayout(); this.listBox.ScrollIntoView(this.listBox.Items[0]); } } this.ensureList(); this.controller.Complete(showAll ? "" : this.textbox.Text); this.actionButton.ShowOnlyIf(this.controller.ShowActionButton && !ActionButtonText.IsNullOrEmpty()); if (closeIfEmpty) { this.popup.IsOpen = this.controller.VisibleItems.Count > 0; } else { this.popup.IsOpen = true; } }