features/rewrite/dropdown #14
@ -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…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user