-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Add design time converters #19301
Add design time converters #19301
Conversation
…VS XAML intellisense
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.
This looks good to me. The Unit Tests should cover the cases where if someone did update the underlying converter without updating the design time converter, causing it to break and force you to update both.
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.
Generally looks good, adding tests where we had none before! 👍
src/Controls/src/Core.Design/ButtonContentDesignTypeConverter.cs
Outdated
Show resolved
Hide resolved
hasY = (xywh.Length == 2 || xywh.Length == 4) && double.TryParse(xywh[1], NumberStyles.Number, CultureInfo.InvariantCulture, out _); | ||
hasW = xywh.Length == 4 && double.TryParse(xywh[2], NumberStyles.Number, CultureInfo.InvariantCulture, out _); | ||
hasH = xywh.Length == 4 && double.TryParse(xywh[3], NumberStyles.Number, CultureInfo.InvariantCulture, out _); | ||
if (!hasW && xywh.Length == 4 && string.Compare("AutoSize", xywh[2].Trim(), StringComparison.OrdinalIgnoreCase) == 0) |
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.
Just thinking out loud: Would this work
if (!hasW && xywh.Length == 4 && string.Compare("AutoSize", xywh[2].Trim(), StringComparison.OrdinalIgnoreCase) == 0) | |
if (!hasW && xywh.Length == 4 && string.Compare("AutoSize", xywh[2].AsSpan().Trim(), StringComparison.OrdinalIgnoreCase) == 0) |
?
I just rembember there was: dotnet/runtime#75452 and https://learn.microsoft.com/en-us/dotnet/api/system.memoryextensions.trim?view=net-7.0.
Add design time converters to improve user experience when using XAML intellisense and hot reload.