-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Conversation
You can test this PR using the following package version. |
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. |
I'm really surprised that WPF exposes a non-observable property here. 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. |
Any updates on this? |
Diff for API review: namespace Avalonia.Controls
{
public class TextBox
{
+ public int LineCount { get; }
}
} |
Sorry for the delay, we'll have an API review soon. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Notes from the API review meeting:
Use a method instead.
Expected API:
public class TextBox
{
public int GetLineCount();
}
You can test this PR using the following package version. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thank you!
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