@using System.Collections.ObjectModel
<div>
<CascadingValue Value="this" Name="PatientInfoEntryPage">
<ListBoxComponent @bind-bindValue="@Value" Height="340" ListBoxValueChanged="ListBoxValueChangedHandler">
</ListBoxComponent>
</CascadingValue>
<button @onclick="changeData">Add Data</button>
<span>selected count: </span> @Value.Count()
</div>
@code{
public int[] Value = new int[] { 1 };
public ObservableCollection<object> DataSource = new ObservableCollection<object>
{
new { Name = "Hennessey Venom", Id = 1 },
new { Name = "Bugatti Chiron", Id = 2 }
};
public void changeData()
{
DataSource.Add(new { Name = "SSC Ultimate Aero", Id = 3 });
}
} |
@using System.Collections.ObjectModel
@inherits EjsListBox<int[]>
<EjsListBox CssClass="e-custom-font" TValue="int[]" DataSource="MainDataSource" @bind-Value="@_bindValue" EnableRtl="true" Height="Height">
<ListBoxEvents TValue="int[]" ValueChange="ValueChangedHandler"></ListBoxEvents>
<ListBoxFieldSettings Text="Name" Value="Id" />
<ListBoxSelectionSettings ShowCheckbox="true"></ListBoxSelectionSettings>
</EjsListBox>
@code {
[CascadingParameter(Name = "PatientInfoEntryPage")]
public Index parent { get; set; }
public ObservableCollection<object> MainDataSource = new ObservableCollection<object>();
protected override void OnParametersSet()
{
MainDataSource = this.parent.DataSource;
}
}
|