I am wondering how to update my status bar with line and column number automatically using the RichTextBox in WPF.
First of all, which event do I hook on to? My box is multiline. KeyDown doesn't react to caret up and down movement.
The line number can be computer using:
int someBigNumber = int.MaxValue;
int lineMoved, currentLineNumber;
editor.CaretPosition.GetLineStartPosition(-someBigNumber, out lineMoved);
currentLineNumber = -lineMoved + 1;
status_bar.Text = "Line " + currentLineNumber.ToString();
How do I get the column?
I know this question is really old but I just solved it after having the issue myself.
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.