Skip to content

How to use a FluentIcon in a TemplateColum of a FluentDataGrid? Getting CS1662 and CS0411 compile errors #3360

Closed Answered by dvoituron
mikeKuester asked this question in Q&A
Discussion options

You must be logged in to vote

This is more of a general question about Blazor and not about FluentUI-Blazor lib.

The FluentIcon component needs an instance of the icon to display via the Value attribute,
as indicated by your compilation error. By using Value=‘@(Icon c => c!.Icon)’ you are using a Lambda expression and not an instance of the icon.

So you need to go for a solution of this type:

<TemplateColumn Title="TempIcon">
    <FluentIcon Value="@(context.TemperatureC.ToIcon())" Color="Color.Accent" />
</TemplateColumn>

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by mikeKuester
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants