I’m trying to automatically select an entire line in a multiline WPF textbox. So if the user clicks on a word on Line 3, the entirety of Line 3 is selected. Any ideas?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
WPF TextBox SelectionStart on MSDN
The easiest way is to take this value and iterate backwards in the content of the TextBox until count hits 0 or
\n \r\n \rand then forwards until text size or\n \r\n \r. After that set the current selection to these boundaries.