<MudIcon Icon="@inboxIcon" Color="Color.Primary" />
Run Code Online (Sandbox Code Playgroud)
@code{
// here this Icon string is coming from database
private string inboxIcon = "Icons.Material.Filled.Inbox";
}
Run Code Online (Sandbox Code Playgroud)
上面的代码没有显示任何图标。如何绑定这个图标字符串?
小智 5
你快到了。试试这样:
<MudIcon Icon="@inboxIcon" Color="Color.Primary" />
@code{
// here this Icon string is coming from database
private string inboxIcon = MudBlazor.Icons.Material.Filled.Inbox;
}
Run Code Online (Sandbox Code Playgroud)
命名空间Icons中的 会自动转换为字符串。
| 归档时间: |
|
| 查看次数: |
2677 次 |
| 最近记录: |