<SfAutoComplete TValue="string" TItem="Colors"
HtmlAttributes="@htmlAttribute" Autofill=true PopupHeight="230px" Placeholder="Select a color"
DataSource="@ColorsData">
<AutoCompleteFieldSettings
Value="Color"></AutoCompleteFieldSettings>
</SfAutoComplete>
@code {
private Dictionary<string, object> htmlAttribute { get; set; } = new Dictionary<string, object>() {
{"maxlength", "6" }
};
public class Colors
{
public string Code { get; set; }
public string Color { get; set; }
}
private ObservableCollection<Colors> ColorsData = new ObservableCollection<Colors>()
{
new Colors() { Color = "Chocolate", Code = "#75523C" },
new Colors() { Color = "CadetBlue", Code = "#3B8289" },
new Colors() { Color = "DarkOrange", Code = "#FF843D" },
new Colors() { Color = "DarkRed", Code = "#CA3832"},
new Colors() { Color = "Fuchsia", Code = "#D44FA3" }
};
}
|