Skip to content

EventCallback not working for generic components #12627

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

Closed
stsrki opened this issue Jul 26, 2019 · 2 comments
Closed

EventCallback not working for generic components #12627

stsrki opened this issue Jul 26, 2019 · 2 comments
Assignees
Labels
area-blazor Includes: Blazor, Razor Components ✔️ Resolution: Duplicate Resolved as a duplicate of another issue investigate

Comments

@stsrki
Copy link
Contributor

stsrki commented Jul 26, 2019

This issue is continuation of #8385

The original problem is fixed but now the problem is that generic typeparam must always be defined when using custom component. It seems that Blazor is not recognizing it implicitly.

The minimal sample can be found here: https://github.com/stsrki/BlazorGenericEventIssue

Not working:

This will giving me error because TValue is not defined:

<SelectEdit Value="@someValue" ValueChanged="@((v) => someValue=v)">

Error CS0029 Cannot implicitly convert type 'Microsoft.AspNetCore.Components.UIWheelEventArgs' to 'int'
Error CS1662 Cannot convert lambda expression to intended delegate type because some of the return types in the block are not implicitly convertible to the delegate return type
Error CS0029 Cannot implicitly convert type 'int' to 'System.Threading.Tasks.Task'
Error CS0266 Cannot implicitly convert type 'object' to 'int'. An explicit conversion exists (are you missing a cast?)

Working:

This is working only after TValue is set. It is not recognized from the context.

<SelectEdit TValue="int" Value="@someValue"ValueChanged="@((v) => someValue=v)">

Expected behavior:

TValue should be automatically detected from the supplied value(s).

@mkArtakMSFT mkArtakMSFT added area-blazor Includes: Blazor, Razor Components investigate labels Jul 29, 2019
@mkArtakMSFT mkArtakMSFT added this to the 3.0.0-rc1 milestone Jul 30, 2019
@marin-bratanov
Copy link

May be related/duplicate of #12226

@mkArtakMSFT mkArtakMSFT assigned pranavkm and unassigned javiercn Aug 5, 2019
@mkArtakMSFT mkArtakMSFT modified the milestones: 3.0.0-rc1, 3.0.0-preview9 Aug 5, 2019
@pranavkm
Copy link
Contributor

pranavkm commented Aug 6, 2019

As @marin-bratanov this is pretty similar to #12226. We'll use the other issue to track further work.

@pranavkm pranavkm added the ✔️ Resolution: Duplicate Resolved as a duplicate of another issue label Aug 6, 2019
@pranavkm pranavkm closed this as completed Aug 6, 2019
@ghost ghost locked as resolved and limited conversation to collaborators Dec 2, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-blazor Includes: Blazor, Razor Components ✔️ Resolution: Duplicate Resolved as a duplicate of another issue investigate
Projects
None yet
Development

No branches or pull requests

5 participants