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

fix: Cannot set ValueChanged without binding in FluentNumberField #2554

Closed
denispaluca opened this issue Aug 19, 2024 · 2 comments
Closed

fix: Cannot set ValueChanged without binding in FluentNumberField #2554

denispaluca opened this issue Aug 19, 2024 · 2 comments
Labels
triage New issue. Needs to be looked at

Comments

@denispaluca
Copy link

🐛 Bug Report

When using a FluentNumberField I want to set the ValueChanged callback manually. When trying to do this I get the compiler error:

CS1503 Argument 2: cannot convert from 'method group' to 'Microsoft.AspNetCore.Components.EventCallback'

💻 Repro or Code Sample

@page "/"

@using BlazorApp2.Pages
@using Microsoft.FluentUI.AspNetCore.Components

<FluentNumberField
    Value="@l"
    ValueChanged="@ChangeValue"
    Label="Number Field" />

@code {
    private long l;

    private void ChangeValue(long value)
    {
        l = value;
    }
}

🤔 Expected Behavior

I should be able to set the ValueChanged callback.

😯 Current Behavior

The compiler forbids me from setting the ValueChanged callback of the FluentNumberField component.

🔦 Context

I am trying to use FluentNumberField and manually control the changes to the property. These changes may contain things that I do not want to include in the setter of the property and they can also be async.

🌍 Your Environment

  • OS & Device: Windows on PC
  • Browser all
  • .NET and Fluent UI Blazor library Version 8.0.7 and 4.7.2
@microsoft-github-policy-service microsoft-github-policy-service bot added the triage New issue. Needs to be looked at label Aug 19, 2024
@MarvinKlein1508
Copy link
Contributor

Try add TValue="long" I would also recommend not using the FluentNumberField component at all because the underlying webcomponents has some nasty bugs. You can read more about it in #1345

I would recommend using a vanilla InputNumber and apply FluentUI style to it.
#1345 (comment)

@vnbaaij
Copy link
Collaborator

vnbaaij commented Aug 22, 2024

Solution provided by @MarvinKlein1508 is correct. So is his advice about not using FluentNumberField btw,

Closing this as it was an issue in calling code

@vnbaaij vnbaaij closed this as completed Aug 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triage New issue. Needs to be looked at
Projects
None yet
Development

No branches or pull requests

3 participants