You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The ComboBox component allows you to change what is rendered in its items, header and footer through templates.
13
+
The AutoComplete component allows you to change what is rendered in its items, header and footer through templates.
14
14
15
-
The examples below show how to use inner tags to set the templates. You can also do this through [RenderFragment](https://blazor.net/api/Microsoft.AspNetCore.Blazor.RenderFragment.html) objects that you can pass to the properties of the ComboBox in its main tag.
15
+
The examples below show how to use inner tags to set the templates. You can also do this through [RenderFragment](https://blazor.net/api/Microsoft.AspNetCore.Blazor.RenderFragment.html) objects that you can pass to the properties of the AutoComplete in its main tag.
16
16
17
17
List of the available templates:
18
18
@@ -23,55 +23,31 @@ List of the available templates:
23
23
24
24
## Item Template
25
25
26
-
The Item template determines how the individual items are rendered in the dropdown element of the component. By default, the text from the model is rendered.
26
+
The Item template determines how the individual items are rendered in the dropdown element of the component. By default, the text from the particular suggestions is rendered.
27
27
28
28
>caption Item Template Example
29
29
30
30
````CSHTML
31
31
@* Define what renders for the items in the dropdown *@
32
32
33
-
<TelerikComboBox @bind-Value=@SelectedValue
34
-
Data="@ComboBoxData"
35
-
ValueField="ProductId"
36
-
TextField="ProductName">
33
+
<TelerikAutoComplete Data="@Suggestions" @bind-Value="@Role" Placeholder="Write your position">
37
34
<ItemTemplate>
38
-
<strong>@((context as Product).ProductName) - @(String.Format("{0:C2}", (context as Product).UnitPrice))</strong>
35
+
Are you a <strong>@context</strong>
39
36
</ItemTemplate>
40
-
</TelerikComboBox>
41
-
42
-
@code {
43
-
public IEnumerable<Product> ComboBoxData { get; set; }
44
-
public int SelectedValue { get; set; } = 2;
45
-
46
-
protected override void OnInitialized()
47
-
{
48
-
List<Product> products = new List<Product>();
49
-
for (int i = 1; i < 10; i++)
50
-
{
51
-
products.Add(new Product()
52
-
{
53
-
ProductId = i,
54
-
ProductName = $"Product {i}",
55
-
UnitPrice = (decimal)(i * 3.14)
56
-
});
57
-
}
58
-
59
-
ComboBoxData = products;
60
-
base.OnInitialized();
61
-
}
62
-
63
-
public class Product
64
-
{
65
-
public int ProductId { get; set; }
66
-
public string ProductName { get; set; }
67
-
public decimal UnitPrice { get; set; }
68
-
}
37
+
</TelerikAutoComplete>
38
+
39
+
@code{
40
+
string Role { get; set; }
41
+
42
+
List<string> Suggestions { get; set; } = new List<string> {
0 commit comments