-
Notifications
You must be signed in to change notification settings - Fork 10.3k
Add support for TypeConverter #10730
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
Conversation
src/Components/Components/src/EventCallbackFactoryBinderExtensions.cs
Outdated
Show resolved
Hide resolved
Sadly, it's not that simple. See: #9386 which tracks all of the work in this area. InvariantCulture will result in the correct behavior for an This PR doesn't cover fixing that issue, and as far as I know just makes the current behavior more clearly explicit. We definitely plan to address this before release. |
src/Components/Components/src/EventCallbackFactoryBinderExtensions.cs
Outdated
Show resolved
Hide resolved
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.
Other than my questions about InvariantCulture
vs CurrentCulture
, this looks great!
Approving now in case it's possible to resolve those last details and merge in time for preview 6.
Sadly we're out of time, this isn't going to make it for preview 6. |
db88626
to
c47c4fb
Compare
Fixes: #8493 Fixes: #9632 Fixes: #9339 Fixes: #8385 Fixes: 10077 This fix adds support for type converters as well as a few other minor things we were missing from binding. The key thing about supporting conversions is that we new can support arbitrary types with `@bind`. This means you can use it with generics, which is something many users have tried. Along with type converters we get Guid and TimeSpan from the BCL. The BCL also includes converters for types we're less interested in like `short`.
c47c4fb
to
9f3ca70
Compare
It's quite convenient to be able to bind directly to data containing raw HTML. This is quite convoluted to do today, requiring registering a TypeDescriptionProvider, which in turn returns a custom type descriptor which in turn can provide the missing TypeConverter for the desired type. This adds support out of the box for binding straight to markup strings. Follows the implementation and tests from dotnet#10730. Closes dotnet#47718
Fixes: #9632
Fixes: #8385
Fixes: #10077
This fix adds support for type converters as well as a few other minor
things we were missing from binding. The key thing about supporting
conversions is that we new can support arbitrary types with
@bind
.This means you can use it with generics, which is something many users
have tried.
Along with type converters we get Guid and TimeSpan from the BCL. The
BCL also includes converters for types we're less interested in like
short
.Note: this change is targeting preview 7.