【问题标题】:How do I keep a textbox scrolled to the end even after I switch focus to another textbox?即使将焦点切换到另一个文本框后,如何保持文本框滚动到末尾?
【发布时间】:2018-08-08 23:52:34
【问题描述】:

我有两个文本框,每次更改文本时都会从 textboxA 复制 textboxB,但 textboxA 不会一直滚动到末尾。它们都是单行文本框,100% 的时间都必须有光标。请帮忙。

    private void Question_TextChanged(object sender, System.Windows.Controls.TextChangedEventArgs e)
    {
        autoComplete.Text = Question.Text;
        autoComplete.Focus();
        autoComplete.Select(autoComplete.Text.Length, 0);
        Question.Focus();
    }

【问题讨论】:

    标签: c# .net wpf textbox focus


    【解决方案1】:

    试试这个: TextboxA.CaretIndex = TextboxA.Text.Length;

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-10-09
      • 2020-03-18
      • 1970-01-01
      • 1970-01-01
      • 2015-01-03
      • 1970-01-01
      相关资源
      最近更新 更多