Add dropdown demo page for implementation testing

pull/14/head
Matija Koželj 2 years ago
parent b250353ad8
commit 0830532e7e

@ -0,0 +1,18 @@
@page "/demo/components/dropdown"
@namespace Connected.Components.Showcase.Runner
@using Connected.Components;
<Dropdown Items=@Items ItemToKey=@((e) => e.Value.ToString()) @bind-SelectedItems="@SelectedItems" AllowMultiple=true>
<OptionTemplate>
@context.Name
</OptionTemplate>
<SelectedValueTemplate>
@context.Name
</SelectedValueTemplate>
</Dropdown>
<div>
@string.Join(", ", SelectedItems.Select(e=> e.Value))
</div>

@ -0,0 +1,29 @@
using System.Collections.ObjectModel;
namespace Connected.Components.Showcase.Runner;
public partial class DropdownDemo
{
private ObservableCollection<TestObject> SelectedItems { get; set; } = new();
private ObservableCollection<TestObject> Items { get; set; } = new ObservableCollection<TestObject>
{
new TestObject
{
Name= "Simple",
Value = 1
},
new TestObject
{
Name = "Simpler",
Value = 2
}
};
public class TestObject
{
public string Name { get; set; }
public long Value { get; set; }
}
}
Loading…
Cancel
Save