Hello Infragistics team,
I would like to perform the following:
I require to enable drag & drop between two xamdatagrids. Both xamdatagrids should enable the group by column functionality. Hence, a user can group the rows in the second datagrid, and can drag a row from the first and drop it to a grouped selection in the second grid. Consequently the row dropped (from first grid) should impact one column in the second grid for all the grouped selection (rows). Te user should only be able to drag one row from the first datagrid, and should be able to dop this row to a grouped selection or more than one row in the second datagrid.
Can you please provide a sample for this requirement. Thank you very much.
This only seems to work if the grid is set to autogenerate fields - AutoGenerateFields="True"
If you have defined your own field layouts the drag is never initiated.
How can I get this to work with a grid made up of non autogenerated fields?
Hello Sherif,
Thank you for your reply. I have been looking into it and as you have requested in your previous post, the sample application that have provided you with is not handling any events in the code behind. In the sample application, I am using EventTriggers and Commands to handle the events, in order to avoid event handling in the code behind and to follow your MVVM pattern. The only code in the xaml.cs files is creating the second window in the MainWindow.xaml.cs:
public partial class MainWindow : Window
{
public MainWindow()
InitializeComponent();
Window1 win = new Window1();
win.Show();
}
This code is for the sample application only and it is not part of the approach I have suggested. I believe that matches your requirement for not event handling and following the MVVM pattern.
Regarding your new requirements, I can suggest using the sample application that I have create for you as basis and implement the logic that you need by yourself, since implementing custom scenarios goes outside of the scope of the Developer Support. You can read more detailed information regarding our support policies here in our web site: http://ko.infragistics.com/help/support-policies/. What I can suggest, if you wish any further implementation of custom scenarios is contacting our Consulting Team, which can provide you with custom implementations based on your scenario. You can read more detailed description of our consulting team here in our website: http://ko.infragistics.com/consulting/
Please let me know if you need any further assistance on the matter.
Sincerely,
Krasimir
Developer Support Engineer
Infragistics
www.infragistics.com/support
Hello,
Thanks a lot for your assistance. Is it possible to implement the drag and drop in the viewmodel class which follows the MVVM pattern instead of the xaml code?
I am also trying to achieve the following:
- A row from the source grid can be dragged to a group in the target grid. For example if I group the rows in the target grid by Column1 (label), and if there are three rows grouped under a column1 label (value: Item 1), I want to be able to drag a row from the source grid to the group in the target grid which has a number of subrows grouped by column1 (label) ... In this case, the changes should apply to all the three rows grouped under the selected group (value: Item 1) which received the dropped row.
- I would like to be able to implement the subrow capability in the dest grid. Everytime a user drags a row from the source to the dest grid, a sub row should be created under the row in the dest grid with the values dragged. A user can drag more than one row from the source grid to the dest grid. Thus, a row in the dest grid can have zero or more subrows depending on the number of rows dropped on it.
Thank you for our replies.
I am just checking if you require any further assistance on the matter.
Thank you for your post. I have been looking into your questions and I have modified the sample application that Stefan has provided you with, in order to implement them. I have use a DataTrigger in the style for the DataRecordPresenter, for the source XamDataGrid, in order to allow only one record to be draggable. Also I have created separate style DataRecordPresneter in the target XamDataGrid, and also created a style for the GroupByRecordPresenter, in order to allow dropping a record into the group records. In order to avoid handling events I have EventTrigger and custom TargetAction<DependencyObject> and I have used a ICommand to handle the Drop event of the DragSoruce.