Hi,
I have a XamDataGrid with my own set of defined field layouts. I was trying to implement drag drop from XamDataGrid to another XamDataGrid/XamDataTree using infragistics DragDrop Framework. But it doesn't seem to be working at all. When I drag a row nothing is happening. Could you please help me on how to achieve drag drop using ig dd framework with my own defined field layout.
Sample Code:
<igDataPresenter:XamDataGrid Name="SalesItemDataGrid" Grid.Row="0" Theme="Office2013" GroupByAreaLocation="AboveDataArea" DataSource="{Binding ActiveNodeSalesItems}" SelectedDataItems="{Binding SelectedSalesItems}" SelectedDataItemsScope="RecordsOnly" ActiveDataItem="{Binding SelectedSalesItemBundle, Mode=TwoWay}">
<igDataPresenter:XamDataGrid.Resources> <Style TargetType="{x:Type igDataPresenter:DataRecordPresenter}"> <EventSetter Event="MouseRightButtonDown" Handler="XamDataGrid_OnMouseRightButtonDown"/> </Style> </igDataPresenter:XamDataGrid.Resources>
<i:Interaction.Behaviors> <behaviors:XamDataGridFilterBehavior /> </i:Interaction.Behaviors>
<ig:DragDropManager.DropTarget> <ig:DropTarget IsDropTarget="True" /> </ig:DragDropManager.DropTarget>
<ig:DragDropManager.DragSource> <ig:DragSource IsDraggable="True" Drop="DragSource_OnDrop" /> </ig:DragDropManager.DragSource>
<igDataPresenter:XamDataGrid.FieldLayoutSettings> <igDataPresenter:FieldLayoutSettings AutoGenerateFields="False" SelectionTypeRecord="Extended" HeaderPrefixAreaDisplayMode="FieldChooserButton" HeaderPresenterStyle="{StaticResource DataGridHeaderStyle}" AutomationProperties.AutomationId="FieldChooserButton"/> </igDataPresenter:XamDataGrid.FieldLayoutSettings>
<igDataPresenter:XamDataGrid.FieldSettings> <igDataPresenter:FieldSettings AllowRecordFiltering="True" AllowEdit="False" CellClickAction="SelectRecord" ExpandableFieldRecordHeaderDisplayMode="AlwaysDisplayHeader" /> </igDataPresenter:XamDataGrid.FieldSettings>
<igDataPresenter:XamDataGrid.FieldLayouts> <igDataPresenter:FieldLayout> <igDataPresenter:UnboundField Label="Name" Name="Name" BindingPath="Name" BindingType="Unbound" /> <igDataPresenter:UnboundField Label="Product Number" Name="ProductNumber" BindingPath="ProductNumber" BindingType="Unbound" /> <igDataPresenter:UnboundField Label="Reference Price" Name="ReferencePrice" BindingPath="ReferencePrice" DataType="{x:Type financial:Money}" BindingType="Unbound" CellValuePresenterStyle="{StaticResource PremiumMoneyEditorViewStyle}"/> <igDataPresenter:UnboundField Label="Global Price List" Name="GlobalListPrice" BindingPath="GlobalListPrice" DataType="{x:Type financial:Money}" BindingType="Unbound" CellValuePresenterStyle="{StaticResource PremiumMoneyEditorViewStyle}"/> <igDataPresenter:UnboundField Label="Gross Price" Name="GrossPrice" BindingPath="GrossPrice" DataType="{x:Type financial:Money}" BindingType="Unbound" CellValuePresenterStyle="{StaticResource PremiumMoneyEditorViewStyle}"/> <igDataPresenter:UnboundField Label="Discount %" Name="UnitaryDiscount.DiscountPercent" BindingPath="UnitaryDiscount.DiscountPercent" BindingType="Unbound" CellValuePresenterStyle="{StaticResource PremiumPercentageEditorViewStyle}"/> <igDataPresenter:UnboundField Label="Discount" Name="UnitaryDiscount.Value" BindingPath="UnitaryDiscount.Value" BindingType="Unbound" CellValuePresenterStyle="{StaticResource PremiumMoneyEditorViewStyle}"/> <igDataPresenter:UnboundField Label="Net Price" Name="NetPrice" BindingPath="NetPrice" DataType="{x:Type financial:Money}" BindingType="Unbound" CellValuePresenterStyle="{StaticResource PremiumMoneyEditorViewStyle}"/> <igDataPresenter:UnboundField Label="Business Unit" Name="BusinessUnit.Name" BindingPath="BusinessUnit.Name" BindingType="Unbound" /> <igDataPresenter:UnboundField Label="Product Area" Name="ProductArea.Name" BindingPath="ProductArea.Name" BindingType="Unbound" /> <igDataPresenter:UnboundField Label="Product Line" Name="ProductLine.Name" BindingPath="ProductLine.Name" BindingType="Unbound" /> <igDataPresenter:UnboundField Label="Fire Code" Name="FireCode.Code" BindingPath="FireCode.Code" BindingType="Unbound" />
............................. </igDataPresenter:FieldLayout> </igDataPresenter:XamDataGrid.FieldLayouts></igDataPresenter:XamDataGrid>
Thanks,
Sreeni
Hi Sreeni,
I took the sample for multiple record drag/drop from here: http://ko.infragistics.com/community/forums/p/90629/447856.aspx#447856
I upgraded it to 14.2 and then I added a XamDataTree to it so that I could drop records from the grid into the tree. Inside the XamDataGridDragDropBehavior.cs file there is an event handler called OnRecordDragDrop. When the user drops the records, this event will fire and from here is where you would add the items to the tree.
Hi Rob,
My requirement is to drag drop multiple records to XamDataTree. If I set SelectionTypeRecord to None, I cannot drag drop multiple records to XamDataTree. Please help.
In order to drag records from a XamDataGrid, the record presenter area needs to be made a drag source. Take a look at the attached sample. The sample has two XamDataGrids. The one on the top is for teams and the one on the bottom is for leagues. You can drag teams from the top datagrid and drop them into a league in the bottom datagrid.