我正在尝试更改 mudblazor 表中一行的颜色。问题是,我无法添加根据行元素的条件更改颜色的功能。
<MudTable Items="@context.orderPositions" Context="AddressContext" Hover="true" Breakpoint="Breakpoint.Sm" Elevation="0" Style="background-color: @(AddressContext.OrderPositionStatus == PositionStatus.rdy ? yellowgreen : blue;">
You can:
<MudTable Items="@Items" Hover="true" RowStyleFunc="RowStyleFunc">
And then
private string RowStyleFunc(Item arg1, int index)
{
switch (arg1.Title)
{
case string a when a.Contains("1/4"):
return "background-color:blue";
case string b when b.Contains("2/4"):
return "background-color:red";
default: return "background-color:white";
}
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)