private void txtGeneric_TextChanged(object sender, TextChangedEventArgs e) { if (internalCall) { return; } String txt = txtGeneric.Text; if (!txt.Equals("") && (win == null)) { win = new WinTextIntellisense(side, txtGeneric, Window.GetWindow(this), TextSearchNameSpace, mrType, isShowDetail, this, extraParam); win.Show(); txtGeneric.Focus(); } if (win != null) { win.RegisterText(txt); } Text = txt; if (TextChanged != null) { TextChanged(sender, e); } }
public void CloseIntellisense() { if (win == null) { return; } String txt = win.GetCurrentText(); win.Close(); win = null; if (txt.Equals("")) { return; } internalCall = true; txtGeneric.Text = txt; txtGeneric.CaretIndex = txt.Length; Text = txt; if (TextChanged != null) { TextChanged(null, null); } if (TextSelected != null) { TextSelected(this, null); } internalCall = false; }
private void txtGeneric_LostFocus(object sender, RoutedEventArgs e) { if (win != null) { win.Close(); win = null; } }
private void txtGeneric_PreviewKeyDown(object sender, System.Windows.Input.KeyEventArgs e) { if (e.Key == Key.Enter) { if (win != null) { e.Handled = true; String txt = win.GetCurrentText(); win.Close(); win = null; if (!txt.Equals("")) { internalCall = true; txtGeneric.Text = txt; txtGeneric.CaretIndex = txt.Length; Text = txt; if (TextChanged != null) { TextChanged(sender, e); } if (TextSelected != null) { TextSelected(this, e); } internalCall = false; } } else { txtGeneric.MoveFocus(new TraversalRequest(FocusNavigationDirection.Next)); } } else if (e.Key == Key.Down) { if (win != null) { e.Handled = true; win.MoveDown(); } } else if (e.Key == Key.Up) { if (win != null) { e.Handled = true; win.MoveUp(); } } else if (e.Key == Key.Escape) { if (win != null) { e.Handled = true; win.Close(); win = null; } } }