|
<SfMultiSelect TValue="string[]" TItem="GameFields" ID="default" Mode="@Syncfusion.Blazor.DropDowns.VisualMode.Box" DataSource="@colorsData">
<MultiSelectFieldSettings Text="Color" Value="Code"></MultiSelectFieldSettings>
<MultiSelectEvents TValue="string[]" TItem="GameFields" OnChipTag="@onTagging"></MultiSelectEvents>
</SfMultiSelect>
<style>
.e-multi-select-wrapper .e-chips {
opacity: 0.9;
}
.e-multi-select-wrapper .e-chips:hover {
opacity: 1;
}
.e-multi-select-wrapper .e-chips .e-chips-close.e-icon::before,
.e-multi-select-wrapper .e-chips .e-chipcontent,
.e-multi-select-wrapper .e-chips .e-chipcontent:hover {
color: #ffffff;
}
...
.e-chips.tomato,
.e-chips.tomato:hover {
background-color: #FF745C;
}
</style>
@code {
public class GameFields
{
public string Color { get; set; }
public string Code { get; set; }
}
List<GameFields> colorsData = new List<GameFields>()
{
new GameFields(){ Color= "Chocolate", Code= "#75523C" },
new GameFields(){ Color= "CadetBlue", Code= "#3B8289" },
new GameFields(){ Color= "DarkOrange", Code= "#FF843D" },
new GameFields(){ Color= "DarkRed", Code= "#CA3832"},
new GameFields(){ Color= "Fuchsia", Code= "#D44FA3" },
new GameFields(){ Color= "HotPink", Code= "#F23F82" },
new GameFields(){ Color= "Indigo", Code= "#2F5D81" },
new GameFields(){ Color= "LimeGreen", Code= "#4CD242"},
new GameFields(){ Color= "OrangeRed", Code= "#FE2A00"},
new GameFields(){Color= "Tomato", Code= "#FF745C"},
};
public void onTagging(Syncfusion.Blazor.DropDowns.TaggingEventArgs<GameFields> args)
{
args.SetClass = args.ItemData.Color.ToLower();
}
} |
|
|