You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
897 B
32 lines
897 B
using Connected.Annotations;
|
|
using Microsoft.AspNetCore.Components;
|
|
|
|
namespace Connected.Components;
|
|
|
|
public abstract class BindableItemsControlBase<TChildComponent, TData> : ItemsControlBase<TChildComponent>
|
|
where TChildComponent : UIComponent
|
|
{
|
|
|
|
/// <summary>
|
|
/// Items Collection - For databinding usage
|
|
/// </summary>
|
|
[Parameter]
|
|
[Category(CategoryTypes.General.Data)]
|
|
public IEnumerable<TData> ItemsSource { get; set; }
|
|
|
|
/// <summary>
|
|
/// Template for each Item in ItemsSource collection
|
|
/// </summary>
|
|
[Parameter]
|
|
[Category(CategoryTypes.General.Appearance)]
|
|
public RenderFragment<TData> ItemTemplate { get; set; }
|
|
|
|
/// <summary>
|
|
/// Gets the Selected Item from ItemsSource, or Selected TChildComponent, when it's null
|
|
/// </summary>
|
|
public object SelectedItem
|
|
{
|
|
get => ItemsSource == null ? Items[SelectedIndex] : ItemsSource.ElementAtOrDefault(SelectedIndex);
|
|
}
|
|
}
|