Comments (4)
Please supply us with ready-to-run reproduction code in the form of something we can copy/paste, a (zipped) project structure or a GitHub repository.
We do not have capacity to craft or compose a reproduction for every issue that gets raised.
If no code or repository is provided, this issue will get closed in 3 days
Help us to help you. Thanks.
from fluentui-blazor.
@vnbaaij Apperantly when you pass a value using ToString
, it does not work correctly.
Example as above
@using Microsoft.FluentUI.AspNetCore.Components
<FluentTextField
Value="@_value.ToString()"
ValueChanged="@ChangeValue" />
@code {
private RandEnum _value;
private void ChangeValue(string newValue)
{
switch(newValue)
{
case "A":
_value = RandEnum.A;
break;
case "C":
_value = RandEnum.C;
break;
default:
_value = RandEnum.A;
break;
}
}
public enum RandEnum {
A,
B,
C
}
}
from fluentui-blazor.
Yeah, I'm not surprised this is not working. _value
is of type enum
where as TextField only supports binding to a string
. This should not even compile...
from fluentui-blazor.
If you change the code to this, it sort of works:
@using Microsoft.FluentUI.AspNetCore.Components
<FluentTextField Value="@_value.ToString()"
ValueChanged="@ChangeValue" ValueExpression="@(() => s)" />
@code {
private RandEnum _value;
private string? s;
private void ChangeValue(string newValue)
{
s = string.Empty;
switch (newValue)
{
case "A":
_value = RandEnum.A;
break;
case "C":
_value = RandEnum.C;
break;
default:
_value = RandEnum.A;
break;
}
s = _value.ToString();
}
public enum RandEnum
{
A,
B,
C
}
}
With 'sort of' I mean it works if you change for A->xyz->C->ghj->etc. If you just change from ne value that resolves to A to another that resolves to A again, the field will not update.
As this is a bit of a strange usage, I'm closing this issue. Hope the provided code will help you further.
from fluentui-blazor.
Related Issues (20)
- Microsoft.JSInterop.JSException: element.addEventListener is not a function HOT 1
- fix: `CSSBuilder` removes valid CSS class names provided by external CSS frameworks HOT 2
- fix: Hybrid Blazor Maui is not working HOT 1
- 4.8.1 FluentDatePicker not work HOT 1
- [DataGrid] OnRowClick and SelectColumn together not as expected. HOT 7
- fix: Setting FillColor design token results in [object Object] instead of correct color HOT 1
- fix: Disabled option does not get showed as selected value when @bind-Value is equal disabled one [FluentSelect] HOT 11
- TreeView: Is it possible to have clicking anywhere on the row expand the item? HOT 1
- fix: Skeleton Component in Light Theme HOT 1
- fix: Duplicates IDs if Overflow in [Overflow] HOT 1
- fix: body background color variable HOT 5
- feat: add the ability to lock (frozen) column when scrolling horizontally in DataGrid HOT 1
- fix: FluentSelect fails in SSR forms HOT 8
- Column Headers on FluentGrid Control Do Not Render Properly with Horizontal Scroll HOT 1
- fix: tooltip anchor diamond moves to the center of the tooltip text box in blazor when using default tooltip position HOT 4
- feat: add Color to/in FluentPersona HOT 4
- Column Headers and Rows on FluentGrid Control Lose Style with Horizontal Scroll HOT 4
- The EventCallbacks of the FluentNavGroup not working. HOT 1
- fix: FluentPersona component source code is in the List/ folder HOT 4
- fix: `FluentProfileMenu`'s inner `FluentPersona` component does not show initials HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fluentui-blazor.