简体   繁体   中英

How do I keep a textbox scrolled to the end even after I switch focus to another textbox?

I have two textboxes, textboxB copies from textboxA every time the text is changed but textboxA doesn't keep scrolling to the end. They're both one line textboxes that must have the cursor at the end 100% of the time. pls help.

    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();
    }

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM