Change AllowDragAndDrop element to AllowDrag and AllowDrop

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.


3 Replies

AS Aravinthan Seetharaman Syncfusion Team August 27, 2021 12:52 PM UTC

 
Thanks for contacting Syncfusion Support. 
 
We have checked your requirement. We can achieve this requirement by preventing one ListBox from Drag using DragStart even handler. Please check the below code snippet and sample. 
 
 
<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; 
    } 
} 
 
 
 
Could you please check the above details, and get back to us, if you need assistance on this. 
 
Regards, 
Aravinthan S 



SP Scott Peal replied to Aravinthan Seetharaman August 27, 2021 02:48 PM UTC

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:

  • Grab item from listbox1 (AllowDrag="true" on listbox1 permits this)
  • Drag and drop onto listbox2 (AllowDrop="true" on listbox2 permits this)


Permitted Process:

  • Grab item from listbox1 (AllowDrag="true" on listbox1 permits this)
  • Drag and drop onto listbox3 (AllowDrop="true" on listbox3 permits this)

Not Permitted Process:
  • Grab item from listbox2 (AllowDrag="true" on listbox1 permits this)
  • Drag and drop onto listbox1 (on DragStart doesn't know the destination listbox. AllowDrop="false" on listbox1 would stop this)

Permitted Process:
  • Grab item from listbox2 (AllowDrag="true" on listbox1 permits this)
  • Drag and drop onto listbox3 (AllowDrag="true" on listbox3 permits this)

Permitted Process:
  • Grab item from listbox3 (AllowDrag="true" on listbox1 permits this)
  • Drag and drop onto listbox2 (AllowDrag="true" on listbox2 permits this)

Not Permitted Process:
  • Grab item from listbox3 (AllowDrag="true" on listbox1 permits this)
  • Drag and drop onto listbox1 (AllowDrag="false" on listbox2 stops this)

Not Permitted Process:
  • Grab item from listbox1 (AllowDrag="true" on listbox1 permits this)
  • Drag and drop onto listbox1 (AllowDrop="false" on listbox1 stops this)


AS Aravinthan Seetharaman Syncfusion Team August 31, 2021 03:01 AM UTC

Hi Scott, 

We have created an incident under your direct trac account. Please follow the incident for further assistance.  
  
Regards,  
Aravinthan S   


Loader.
Up arrow icon