WPF单行TextBox自动滚动至末尾

根据光标位置自动滚动
textBox.CaretIndex = textBox.SelectionStart;
var rect = textBox.GetRectFromCharacterIndex(textBox.CaretIndex);
textBox.ScrollToHorizontalOffset(rect.Right);

 

posted @ 2022-07-15 11:27  韶光荏苒  阅读(850)  评论(0编辑  收藏  举报