Set Cursor Position to specific line in Multiline textbox c# winui 3

Hemanth B 886 Reputation points

Hi I am using C# WinUI 3 WinAppSDK for my app.

I want to set the position of the cursor to a specific line in the multiline textbox.
I've searched the web a lot but couldn't find suitable answers.

For example, I have 34 lines of text in a textbox.
I want the cursor to scroll to the 31st line of the textbox.
How do I initiate this?

Windows App SDK
Windows App SDK
A set of Microsoft open-source libraries, frameworks, components, and tools to be used in apps to access Windows platform functionality on many versions of Windows. Previously known as Project Reunion.
731 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Junjie Zhu - MSFT 15,836 Reputation points Microsoft Vendor

    Hello @Hemanth B ,
    Welcome to Microsoft Q&A!

    At present, it can only be achieved by selecting the text content, but the specific line cannot be operated directly, which may require calculation.

    You can go to GitHub and ask if there is a better solution.

    Thank you.

    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments