|
<SfListBox TValue="string[]" DataSource="@Data" TItem="VehicleData">
<ListBoxFieldSettings Text="Text" Value="Id" />
<ListBoxEvents TValue="string[]" TItem="VehicleData" OnActionComplete="updateItems"> </ListBoxEvents>
</SfListBox>
public void updateItems(ActionCompleteEventArgs<VehicleData> args) {
// You can customize your code here.
} |
|
<SfListBox @ref="listbox1" Scope="@scope1" DataSource="@GroupA"
TItem="ListData" Height="330px" TValue="string[]">
<ListBoxFieldSettings Text="Name" Value="Code"></ListBoxFieldSettings>
<ListBoxToolbarSettings Items="@Items"></ListBoxToolbarSettings>
<ListBoxEvents TValue="string[]" TItem="ListData"
OnActionComplete="ActionComplete"></ListBoxEvents>
</SfListBox>
<SfListBox @ref="listbox2" Scope="@scope2" DataSource="@GroupB"
Height="330px" TItem="ListData" TValue="string[]">
<ListBoxFieldSettings Text="Name" Value="Code"></ListBoxFieldSettings>
</SfListBox>
@code
{
public void ActionComplete(ActionCompleteEventArgs<ListData> args)
{
// You can customize your code here.
}
} |
|
<SfListBox @ref="listbox1" DataSource="@GroupA" Scope="@listbox2"
TItem="ListData" AllowDragAndDrop="true" Height="330px" TValue="string[]">
<ListBoxFieldSettings Text="Name" Value="Code"></ListBoxFieldSettings>
<ListBoxEvents TValue="string[]" TItem="ListData"
OnDrop="Drop" DragStart="Drag"></ListBoxEvents>
</SfListBox>
<SfListBox @ref="listbox2" DataSource="@GroupB" Scope="@listbox1"
TItem="ListData" AllowDragAndDrop="true" Height="330px" TValue="string[]">
<ListBoxFieldSettings Text="Name" Value="Code"></ListBoxFieldSettings>
</SfListBox>
@code{
public void Drop(DropEventArgs<ListData> args)
{
// Your code
}
public void Drag(DragEventArgs<ListData> args)
{
// Your code
}
} |
|
<SfListBox TValue="string[]" TItem="VehicleData"
DataSource="@Vehicles" @ref="ListBoxObj">
<ListBoxFieldSettings Text="Text" Value="Id" />
</SfListBox>
<SfButton @onclick="addData">ADD ITEMS</SfButton>
@code {
SfListBox<string[], VehicleData> ListBoxObj;
public List<VehicleData> Vehicles = new List<VehicleData> {
new VehicleData { Text = "Hennessey Venom", Id = "Vehicle-01" },
new VehicleData { Text = "Bugatti Chiron", Id = "Vehicle-02" },
new VehicleData { Text = "Bugatti Veyron Super Sport", Id = "Vehicle-03" },
new VehicleData { Text = "SSC Ultimate Aero", Id = "Vehicle-04" },
new VehicleData { Text = "Koenigsegg CCR", Id = "Vehicle-05" },
};
public class VehicleData
{
public string Text { get; set; }
public string Id { get; set; }
}
public List<VehicleData> Item = new List<VehicleData>{
new VehicleData{ Text = "Ferrari LaFerrari", Id = "Vehicle-06"},
new VehicleData{ Text = "McLaren P1", Id = "Vehicle-7"}
};
private async Task addData()
{
await ListBoxObj.AddItem(Item);
// Your code
}
}
|