Hi,
In the docs/demos it show how to drag and drop between list. How do we drag from list1 and drop to list2, but leave the item in list1. Thus cloning a new item into list2?
Also how to prevent user from dragging from list2 and dropping on list1?
Thanks
|
<div id="listbox1">
<h4>Group A</h4>
<SfListBox TValue="string[]" DataSource="@GroupA" AllowDragAndDrop="true" Scope="combined-list" Height="290px" TItem="CountryCode" @ref="ListObj">
<ListBoxFieldSettings Text="Name" Value="Code" />
<ListBoxEvents TItem="CountryCode" TValue="string[]" Dropped="Dropped"></ListBoxEvents>
</SfListBox>
</div>
<div id="listbox2">
<h4>Group B Drop Only</h4>
<SfListBox TValue="string[]" DataSource="@GroupB" Scope="combined-list" AllowDragAndDrop="true" Height="290px" TItem="CountryCode">
<ListBoxFieldSettings Text="Name" Value="Code" />
<ListBoxEvents TItem="CountryCode" TValue="string[]" DragStart="DragStart"></ListBoxEvents>
</SfListBox>
</div>
public async Task Dropped(DragEventArgs<CountryCode> args)
{
await ListObj.AddItems(args.Items, (int)args.PreviousIndex);
} |
|
<div id="listbox1">
<h4>Group A</h4>
<SfListBox TValue="string[]" DataSource="@GroupA" AllowDragAndDrop="true" Scope="combined-list" Height="290px" TItem="CountryCode" @ref="ListObj">
<ListBoxFieldSettings Text="Name" Value="Code" />
<ListBoxEvents TItem="CountryCode" TValue="string[]" Dropped="Dropped"></ListBoxEvents>
</SfListBox>
</div>
<div id="listbox2">
<h4>Group B Drop Only</h4>
<SfListBox TValue="string[]" DataSource="@GroupB" Scope="combined-list" AllowDragAndDrop="true" Height="290px" TItem="CountryCode">
<ListBoxFieldSettings Text="Name" Value="Code" />
<ListBoxEvents TItem="CountryCode" TValue="string[]" DragStart="DragStart"></ListBoxEvents>
</SfListBox>
</div>
public void DragStart(DragEventArgs<CountryCode> args)
{
args.Cancel = true;
} |