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. Image for the cookie policy date

Sf Data Grid Drag Column Header To a TextBox Control

Hi,

I am actually using this control in wpf, but somehow the wpf section is bugged and does'nt show any item under the Control drop down, making me unable to create the thread.

So my question is, may I know the way on how to drag a sfDataGrid column header to a textbox outside the Grid while the Property, AllowDraggingColumns of sfDataGrid is set to true.


Thanks & best regards,
Kevin

3 Replies

SC Saravanan C Syncfusion Team April 29, 2014 04:00 PM UTC

Hi Kevin,

 

We have analyzed your requirement and you can achieve your requirement by using the QueryColumnDragging event. Please find the code snippet and sample in the following location.

 

Code Snippet [c#]:

 

this.dataGrid.QueryColumnDragging += dataGrid_QueryColumnDragging;

 

void dataGrid_QueryColumnDragging(object sender, Syncfusion.UI.Xaml.Grid.QueryColumnDraggingEventArgs e)

{

    if(e.Reason==QueryColumnDraggingReason.Dropping)

    {

        var rect = GetControlRect(this.textBox);

        if (rect.Contains(e.PopupPosition))

        {

            var column = dataGrid.Columns[e.From];

            textBox.Text = column.MappingName;

        }

    }

}

 

Sample: http://www.syncfusion.com/downloads/support/directtrac/123397/ColumnHeaderDraggingTextBox1628042208.zip

 

Please let us know if you have any queries.

 

Regards,

Saravanan C



KK Kevin Kuan May 2, 2014 03:24 AM UTC

Hi Saravanan,

Thanks alot, the things works, it is now able to put the column name into the textBox.

However, the next question is on the dragging adornment, it is still having a cross sign when i drag the item into the area of textbox, would i be able to remove the cross sign if the textbox i'm dragging to allow me to drop the dragging item in?


Thanks,
Kevin

Attachment: dragging_adornment_3c662940.rar


SC Saravanan C Syncfusion Team May 5, 2014 11:49 AM UTC

Hi Kevin,

 

We have analyzed your query and you can remove the cross sign by overriding GridColumnDragDropController. Please find the code snippet and sample in the following location,

 

Code snippet[c#]:

 

protected override void OnPopupContentPositionChanged(double HorizontalDelta, double VerticalDelta, Point mousePoint, Point mousePointOverGrid)

 

{

    base.OnPopupContentPositionChanged(HorizontalDelta, VerticalDelta, mousePoint,   mousePointOverGrid);

    VisualStateManager.GoToState(this.PopupContentControl, “Valid”, true);

}

 

Sample:http://www.syncfusion.com/downloads/support/directtrac/general/ColumnHeaderDraggingTextBox149644316.zip

 

Please let us know if you have any queries.

 

Regards,

Saravanan C


Loader.
Up arrow icon