Quantcast
Channel: Active questions tagged blazor - Stack Overflow
Viewing all articles
Browse latest Browse all 4839

Blazor FluentUI Swatch not translated to Color Hex

$
0
0

I'm trying to change the style of a Fluent UI switch, so that the color of the dot is different when the switch is off.

My Html:

<FluentSwitch @ref="ref1"/>

And my code behind:

private Microsoft.FluentUI.AspNetCore.Components.DesignTokens.Swatch customColor = "#0473ce".ToSwatch();[Inject]private NeutralForegroundRest neutralForegroundRest { get; set; } = default!;private FluentSwitch? ref1;protected override async Task OnAfterRenderAsync(bool firstRender){    if (firstRender)    {        await neutralForegroundRest.SetValueFor(ref1!.Element, customColor);    }}

This code seems to work, and actually update the value for the CSS element, however, it changes to [object Object] instead of the expected Hex code.

enter image description here

How should this be fixed so that the hex code is actually set instead of the [object Object]?


Viewing all articles
Browse latest Browse all 4839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>