Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TextBox] Add readonly property: LineCount. #17656

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

rabbitism
Copy link
Contributor

What does the pull request do?

Port WPF property to Avalonia
https://github.com/dotnet/wpf/blob/a08bc2f79bb45e46257368363b4bff594a0c848c/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Controls/TextBox.cs#L899-L920

What is the current behavior?

What is the updated/expected behavior with this PR?

How was the solution implemented (if it's not obvious)?

Some notes about test cases:
The test cases are what I observed from actual running app's behavior.

Checklist

Breaking changes

Obsoletions / Deprecations

Fixed issues

@avaloniaui-bot
Copy link

You can test this PR using the following package version. 11.3.999-cibuild0053635-alpha. (feed url: https://nuget-feed-all.avaloniaui.net/v3/index.json) [PRBUILDID]

@maxkatz6
Copy link
Member

maxkatz6 commented Dec 1, 2024

Not sure how impactful on perf it would be, but LineCount can be a DirectProperty, supporting change notifications.

@rabbitism
Copy link
Contributor Author

Not sure how impactful on perf it would be, but LineCount can be a DirectProperty, supporting change notifications.

TextLayout.TextLines cannot be subscribed, thus we have to report change for every Text change and Bounds change. It can be expensive.

@MrJul
Copy link
Member

MrJul commented Dec 15, 2024

I'm really surprised that WPF exposes a non-observable property here.
I can already see the bug reports coming in from bindings not working.

If we can't bind it, maybe it should be a method instead?

@rabbitism
Copy link
Contributor Author

If we can't bind it, maybe it should be a method instead?

I don't have a preference, please let me know if team get a final decision.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants