Hello,
Does the XamDataGrid support the DragDropManager?
I would like to use the DragDropManger to allow me to drag a row from a XamDataGrid to another control (another XamDataGrid or a XamDataTree for instance). I am unable to drag a row from a XamDataGrid using the DragDropManager. How can I do this?
I am able to set a DragDropManager.DropTarget on a XamDataGrid and drop from a XamDataTree. However I don't get the row that was dropped on. I have to write a bunch of code to discover the row. Is there a way to easily know what row was dropped on?
Thanks,
Chris
Hello Chris,
I have been investigating your requirement and what you can do to achieve your goal is retemplate the visual of the element you want to drag out of the XamDataGrid. I have created a sample project for you (Grid_DragDropFramework.zip) showing how you can drag DataRecords by retemplating the DataRecordPresenter. What I did was get a copy of the original template and the DragSource to its root element.
Please look into the sample and let me know if I have missed something out or if I can assist you any further on the matter.
Sincerely,
Petar Monov
Developer Support Engineer
Infragistics Bulgaria
www.infragistics.com/support
How do I simply drag and drop a node from a xamdatatree to a xamdatagrid?
I have also created a sample with a XamDataTree and XamDataGrid using the same approach as t eh previous one (DataTree_Grid_DragDrop.zip).
Please test it out and let me know if you require any further clarification on the matter.
Hello!I want to use Drag and Drop for elements inside XamTreeGrid. Is it possible? Please, give me example.
I used the sample code to successfully drag and drop from the xamdatatree to the xamdatagrid.
But I'm getting a NullReferenceException error in the VS2010 designer in the controltemplate for the DataRecordPresenter. The line that is causing this problem is commented out in the following xaml:
<
Borderx:Name="RecordSeparator" Grid.Row="2" Grid.Column="1"Visibility="Collapsed"Grid.ColumnSpan="6"/>
<!-- Style="{DynamicResource {ComponentResourceKey {x:Type igDP:XamDataGrid}, RecordSeparatorStyle}}" -->
If I put this line back in to the <Border> definition, I get the NullReferenceException error in the designer. I went thru the entire controltemplate and changed any "ComponentResourceKey" bindings to use "x:Static" instead but I could not figure out how to change the binding for the Style property, for example:
<BorderVisibility="Collapsed"Background="{DynamicResource {x:Static igDP:DataPresenterBrushKeys.AddRowBackgroundKey}}"BorderBrush="{TemplateBinding BorderBrush}"HorizontalAlignment="Stretch"x:Name="addRowFooter"VerticalAlignment="Stretch"Width="Auto"Height="Auto"BorderThickness="{TemplateBinding BorderThickness}"SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
Instead of:
<BorderVisibility="Collapsed"Background="{DynamicResource {ComponentResourceKey {x:Type igDP:XamDataGrid}, AddRowBackground}}"BorderBrush="{TemplateBinding BorderBrush}"HorizontalAlignment="Stretch"x:Name="addRowFooter"VerticalAlignment="Stretch"Width="Auto"Height="Auto"BorderThickness="{TemplateBinding BorderThickness}"SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
Any ideas abount how to change the binding not to use "ComponentResourceKey" or another way to get rid of the NullReferenceException error?
Dalia
Hi Chris,
I am really glad, I could help out. If you do not have any further questions, please verify this thread as answered, so it helps other users as well.
Thanks in advance.
Best regards Petar.
I received your sample project and it allows me to drag out of a XamDataGrid. There was a substantial amount of Xaml code to achieve the objective of dragging a row from the grid. While awaiting your response I went ahead and derived a class from XamDataGrid and put drag/drop functionality into it. I believe both solutions will work for me. I am still adding functionality to the product on which I am working and will wind up using whatever solution works best in the long term. Thanks for your attention to this matter and the effort you put into it.
I am just checking the progress of this issue and was wondering if you managed to achieve your goal or if you need any further assistance on the matter.
If the above suggestion helped you solve your issue please verify the thread as answered so other users may take better advantage of it.