By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,670 Members | 1,501 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,670 IT Pros & Developers. It's quick & easy.

scroll a textbox so bottom-most line always shows

P: n/a
I add lines to my textbox (WPF) showing the progress of processes. I'd like
the visible part to scroll so that the most recent line is always visible.
The following does not scroll, but it does refresh. Any ideas?

private void onProgress(string msg)
{
txtProgress.Text += msg + (char)13;
txtProgress.CaretIndex = txtProgress.Text.Length;
oSessionControl.doEvents();
}

doEvents is borrowed code that refreshes the screen.
Jul 3 '08 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Jeremy,

I haven't worked on WPF.
But I looked at the doc & following could help. Try it

txtProgress.ScrollToLine(txtProgress.LineCount);
or
// if it is a 0 based index
txtProgress.ScrollToLine(txtProgress.LineCount - 1);

Does that work?

Kalpesh
Jul 3 '08 #2

P: n/a
Solved. As soon as I finished typing, I saw all those references to scroll
and ....

The answer was

txtProgress.ScrollToLine(txtProgress.LineCount-1);

Jul 3 '08 #3

This discussion thread is closed

Replies have been disabled for this discussion.