private void SetCurrentToken(AutoCompleteTipsItem t) { Item = t; //int s = textBox.SelectionStart; //int e = textBox.SelectionStart + textBox.SelectionLength; //int first = -1; //if (e > 1) //{ // first = textBox.Text.LastIndexOf('#', e - 1); //} //if (first == -1) //{ // textBox.Text = t.Content; //} //else //{ // textBox.Text = textBox.Text.Substring(0, first + 1) + t; //} textBox.Text = t.Content; textBox.Select(textBox.Text.Length, 0); }
private void SetCurrentToken(AutoCompleteTipsItem t) { Item = t; int s = textBox.SelectionStart; int e = textBox.SelectionStart + textBox.SelectionLength; int first = -1; if (e > 1) { first = textBox.Text.LastIndexOf('#', e - 1); } if (first == -1) { textBox.Text = t.Content; } else { textBox.Text = textBox.Text.Substring(0, first + 1) + t; } textBox.Select(textBox.Text.Length, 0); }