Pass parameter to FluentIcon-Value #3459
-
Is it possible, for example, to pass a parameter value for “<FluentIcon Value=”@(new Icons.Regular.Size24.Save())“ />” instead of “@(new Icons.Regular.Size24.Save())”? I tried it with a model, but that doesn't work. Model
Razor
Thanks |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
Try: public Microsoft.FluentUI.AspNetCore.Components.Icon? Icon { get; set; } If you can't change the type then try casting it: <FluentIcon Value="@(Icon as Microsoft.FluentUI.AspNetCore.Components.Icon)" />
@code {
[Parameter]
public object? Icon { get; set; }
} |
Beta Was this translation helpful? Give feedback.
-
Hi @rpodevns Thanks, it works now! Here is the final code: Model
Razor
pc |
Beta Was this translation helpful? Give feedback.
-
That's great. You should be able to remove the cast since you're specifying the type in your MessageDialog class. Change: <FluentIcon Value="@(Content.Icon as Microsoft.FluentUI.AspNetCore.Components.Icon)" /> To: <FluentIcon Value="@Content.Icon" /> |
Beta Was this translation helpful? Give feedback.
Try:
If you can't change the type then try casting it: