Please consider changing the
AllowDragAndDrop="true"
to two individual controls:
AllowDrag="true"
AllowDrop="true"
This way we can restrict a listbox to only permit receiving drops and another listbox permitted to drag.
|
<div id="listbox1">
<h4>Group A</h4>
<SfListBox TValue="string[]" DataSource="@GroupA" AllowDragAndDrop="true" Scope="combined-list" Height="290px" TItem="CountryCode">
<ListBoxFieldSettings Text="Name" Value="Code" />
</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>
@code {
public class CountryCode
{
public string Name { get; set; }
public string Code { get; set; }
}
public void DragStart(DragEventArgs<CountryCode> args)
{
args.Cancel = true;
}
}
|
That doesn't solve the issue. If we want listbox1 to be dragged from but not dropped on from another listbox2. The DragStart will not know the destination listbox. Here are the processes for the example where having separate permissions would help. All listboxes (1,2, & 3) are in the same scope.
Permitted Process:
Permitted Process: