private void ApplyAutocomplete(AutocompleteItem item, Range fragment) { string newText = item.GetTextForReplace(); //replace text of fragment fragment.Text = newText; fragment.TargetWrapper.TargetControl.Focus(); }
public void AddItem(AutocompleteItem item) { if (sourceItems == null) { sourceItems = new List <AutocompleteItem>(); } if (sourceItems is IList) { (sourceItems as IList).Add(item); } else { throw new Exception("Current autocomplete items does not support adding"); } }
internal virtual void OnSelecting() { if (SelectedItemIndex < 0 || SelectedItemIndex >= VisibleItems.Count) { return; } AutocompleteItem item = VisibleItems[SelectedItemIndex]; var args = new SelectingEventArgs { Item = item, SelectedIndex = SelectedItemIndex }; OnSelecting(args); if (args.Cancel) { SelectedItemIndex = args.SelectedIndex; (Host.ListView as Control).Invalidate(true); return; } if (!args.Handled) { Range fragment = Fragment; ApplyAutocomplete(item, fragment); } Close(); // var args2 = new SelectedEventArgs { Item = item, Control = TargetControlWrapper.TargetControl }; item.OnSelected(args2); OnSelected(args2); }
public void AddItem(AutocompleteItem item) { if (sourceItems == null) sourceItems = new List<AutocompleteItem>(); if (sourceItems is IList) (sourceItems as IList).Add(item); else throw new Exception("Current autocomplete items does not support adding"); }
public void ShowToolTip(AutocompleteItem autocompleteItem, Control control = null) { string title = autocompleteItem.ToolTipTitle; string text = autocompleteItem.ToolTipText; if (control == null) control = this; if (string.IsNullOrEmpty(title)) { toolTip.ToolTipTitle = null; toolTip.SetToolTip(control, null); return; } if (string.IsNullOrEmpty(text)) { toolTip.ToolTipTitle = null; toolTip.Show(title, control, Width + 3, 0, ToolTipDuration); } else { toolTip.ToolTipTitle = title; toolTip.Show(text, control, Width + 3, 0, ToolTipDuration); } }