Is it possible you guys can post some sample code, that shows drag and drop from XamDataGrid's Field Chooser to the ColumnsFieldDropAreaControl. We have a XamDataGrid and XamPivotGrid in the same screen, and I want to be able to drag columns from XamDataGrid's field chooser to the ColumnsFieldDropAreaControl/RowFieldsDropAreaControl.
Hi Anand,
This might be tricky since the field chooser on the XamDataGrid and the ColumnsFieldDropAreaControl in the pivot grid have their own drag drop handling. I'm putting together a sample to see what can be done. I will get back to you after the investigation.
This was a bit simpler than I initially thought. As I said previously, the XamDataGrid implements it's own version of drag/drop and currently it is not possible to hook into this. So to make this work I handled the PreviewMouseLeftButtonDown event on the LabelPresenter inside the FieldChooser and the PreviewMouseLeftButtonUp event on the ToolWindow that contains the FieldChooser. When the button down event fires, I grab the Field and store it. In the button up event, as long as there's a valid Field I check to see if the mouse was released above the ColumnsFieldDropAreaControl. If it was released above this, it adds the appropriate dimension to the XamPivotGrid.DataSource.Columns collection.
I have attached my sample for your consideration. Let me know if you have any questions on this.
Thanks Rob this works well. Thanks for this, also is there any way we can drag from the columns in the data grid to this pivot grid too. I tried this and this breaks the grouping functionality. Any advice here ? Thanks so much for your help in advance!!!
If you can please post some sample code for this. Thanks again Rob.
I tried putting a DragSource handler in the overriden Label Presenter style, this does the job for the Grid and the field chooser, but breaks the grouping functionality which we very much need. Any other clues would be greatly appreciated.