features/rewrite/dropdown #14

Merged
koma merged 10 commits from features/rewrite/dropdown into features/rewrite/main 2023-03-15 09:38:57 +00:00
2 changed files with 47 additions and 0 deletions
Showing only changes of commit 0830532e7e - Show all commits

View File

@ -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>

View File

@ -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; }
}
}