We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

DragDrop, DragOver and TableControlMouseDown

Thread ID:

Created:

Updated:

Platform:

Replies:

145788 Jul 8,2019 07:43 PM UTC Jul 9,2019 07:16 AM UTC WinForms 3
loading
Tags: GridGroupingControl
Gregory Pe
Asked On July 8, 2019 07:43 PM UTC

Hi
how to do to insert into textBox1 or textBox2
the name of the column header gridGroupingControl1.
After dragging the right mouse button to the appropriate textBox1 or textBox2


Attachment: test_ggc007_4b26763d.rar

Jagadeesan Pichaimuthu [Syncfusion]
Replied On July 9, 2019 06:28 AM UTC

Hi Gregory, 
  
Thanks for using Syncfusion product. 
  
To drag and drop the column header text, you could handle the TableControlMouseDown event. Please refer the following code example and the modified sample. 
  
C# 
this.gridGroupingControl1.TableControlMouseDown += gridGroupingControl1_TableControlMouseDown; 
  
void gridGroupingControl1_TableControlMouseDown(object sender, Syncfusion.Windows.Forms.Grid.Grouping.GridTableControlMouseEventArgs e) 
{ 
    GridGroupingControl grid = sender as GridGroupingControl; 
    if (grid != null) 
    { 
        GridTableControl tableControl = grid.TableControl; 
        Syncfusion.Windows.Forms.Grid.Grouping.GridColumnDescriptor columnDescriptor = gridGroupingControl1.TableControl.GetHeaderColumnDescriptorAt(e.Inner.Location); 
        if (columnDescriptor != null) 
        { 
            rightClickCol = columnDescriptor.HeaderText; 
  
            DragDropEffects ef = tableControl.DoDragDrop(rightClickCol, DragDropEffects.Copy); 
        } 
    } 
} 
  
textBox.AllowDrop = true; 
textBox.DragDrop += TextBox1_DragDrop; 
textBox.DragEnter += TextBox1_DragEnter; 
  
private void TextBox1_DragEnter(object sender, DragEventArgs e) 
{ 
    if (e.Data.GetDataPresent(DataFormats.Text)) e.Effect = DragDropEffects.Copy; 
} 
  
private void TextBox1_DragDrop(object sender, DragEventArgs e) 
{ 
    var data = e.Data.GetData(DataFormats.Text); 
    if(data != null) 
    { 
        (sender as TextBox).Text = data.ToString(); 
    } 
} 
  
                                            
Please get back to us if you need any further assistance on this. 
  
Regards, 
Jagadeesan

Gregory Pe
Replied On July 9, 2019 07:11 AM UTC

Hi Gregory, 
  
Thanks for using Syncfusion product. 
  
To drag and drop the column header text, you could handle the TableControlMouseDown event. Please refer the following code example and the modified sample. 
  
C# 
this.gridGroupingControl1.TableControlMouseDown += gridGroupingControl1_TableControlMouseDown; 
  
void gridGroupingControl1_TableControlMouseDown(object sender, Syncfusion.Windows.Forms.Grid.Grouping.GridTableControlMouseEventArgs e) 
{ 
    GridGroupingControl grid = sender as GridGroupingControl; 
    if (grid != null) 
    { 
        GridTableControl tableControl = grid.TableControl; 
        Syncfusion.Windows.Forms.Grid.Grouping.GridColumnDescriptor columnDescriptor = gridGroupingControl1.TableControl.GetHeaderColumnDescriptorAt(e.Inner.Location); 
        if (columnDescriptor != null) 
        { 
            rightClickCol = columnDescriptor.HeaderText; 
  
            DragDropEffects ef = tableControl.DoDragDrop(rightClickCol, DragDropEffects.Copy); 
        } 
    } 
} 
  
textBox.AllowDrop = true; 
textBox.DragDrop += TextBox1_DragDrop; 
textBox.DragEnter += TextBox1_DragEnter; 
  
private void TextBox1_DragEnter(object sender, DragEventArgs e) 
{ 
    if (e.Data.GetDataPresent(DataFormats.Text)) e.Effect = DragDropEffects.Copy; 
} 
  
private void TextBox1_DragDrop(object sender, DragEventArgs e) 
{ 
    var data = e.Data.GetData(DataFormats.Text); 
    if(data != null) 
    { 
        (sender as TextBox).Text = data.ToString(); 
    } 
} 
  
                                            
Please get back to us if you need any further assistance on this. 
  
Regards, 
Jagadeesan

Hi Jagadeesan
thank you for the quick reply

Regards, 
Gregory


Jagadeesan Pichaimuthu [Syncfusion]
Replied On July 9, 2019 07:16 AM UTC

Hi Gregory, 
 
Thanks for your update. 
 
Please let us know if you have any further queries on this. We are happy to help you. 
 
Regards, 
Jagadeesan 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon