Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does the pull request do?
Adds the method
ScrollToLine
to theTextBox
control.What is the current behavior?
No obvious API for moving the caret to a specific line. This is not "compatible" with WPF.
What is the updated/expected behavior with this PR?
ScrollToLine
with a line index will move the caret index to the first position on the specified line index.TextBoxTests.cs
How was the solution implemented (if it's not obvious)?
ScrollToLine
will get theTextLine
object from the collection and use theTextPresenter.MoveCaretToTextPosition
API to move the caret.Perhaps this is a bit naive implementation. The WPF implementation gets a bounding rectangle and brings that into view.
Checklist
Unsure if this method requires updated docs since not everything is included in the docs. Happy to do so if suggested.
Breaking changes
None that I know of.
Fixed issues
Addresses #3036 at least partially. It would be nice with convenience API:s like ScrollToHome and ScrollToEnd. Those would delegate to existing internal API or to the same API on the
ScrollViewer
.I'll leave it to the maintainers to decide if #3036 can be closed or not.