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.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Sf Data Grid Drag Column Header To a TextBox Control

Thread ID:

Created:

Updated:

Platform:

Replies:

116218 Apr 28,2014 06:21 AM UTC May 5,2014 11:49 AM UTC WPF 3
loading
Tags: GridDataControl
Kevin Kuan
Asked On April 28, 2014 06:21 AM UTC

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

Saravanan C [Syncfusion]
Replied On 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


Kevin Kuan
Replied On 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

Saravanan C [Syncfusion]
Replied On 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


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.

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

;