I almost have this working and just need some guidance on whether I'm going about this correctly and more importantly how to fix the tiny issue I am having.
I have uploaded a small sample project with the problem mentioned below.
I want to be able to drag multiple grid rows from the XamGrid to a XamTree. I don't physically need anything to move or change, I just need it to appear to the user they are dragging something to a specific XamTreeitem.
By crawling the forums I found a couple different approaches to this. Non seemed to be a perfect fit or to work completely but I was able to splice together something that almost works.
Approach
I loaded the tree nodes dynamically in code-behind and call SetDropTarget to specify which nodes are DropTargets. Working perfectly.
I could not figure out how to get XamGrid row's to be Drag Source objects. I posted elsewhere about this but know one has replied.
I found an example where they provided a custom DragTemplate at the XamGrid level. I put a TextBlock in the DataTemplate with Text="" so I basically get what I want. Just the default drag cursor and not the whole entire grid moving. This seems to work and I have only one issue with the XamGrid.
After the drag is finished, if I move the mouse back to the XamGrid, it starts selected all rows until I refocus or re-click the grid. Its like something gets messed up with its Visual State.
Any help would be greatly appreciated.
Hello,
It's because of a bug of DragDrop. A new service release is expected in next few days where this issue is fixed.
Best regards.Plamen.
Great! I eagerly await the service release.
I have 1 more problem to figure out. Grid rows can only be dragged to certain folders. I was originally thinking that I could set DropChannel and DragChannel but since I cannot figure out how to set the drag source on a row by row basis this doesn't appear to be an option.
How would your recommend that during that dragover I calculate that the grid row (or rows) is actually allowed to be dropped on this particular XamTreeItem and if its not, change curror back to not allowed?
I think this is my last hurdle.
Thanks in advance!
Ken
Hi Ken,
The selection issue is fixed in the service release.
Regards.Plamen.
Plamen,
Any idea when that service release is coming out?
Is there a forum or place on your site I can read about service releases (dates and info on what was fixed etc).
Hello Ken,
Here you can find information about service releases.
Bummer, I don't see a service release for 10.2 Line of Business (which has the same problem). I only see a 10.1 service release. Was hoping to bite the bullet and just upgrade to 10.2 to get the name spaces in order.
Thanks for all your help guys.
Hi,
The 10.2 SR was just released:
http://es.infragistics.com/dotnet/netadvantage/silverlight/line-of-business.aspx#Downloads
For some reason the link Plamen sent you wasn't updated to contain the 10.2 SR.
-SteveZ
I want to set rows in an XamWebGrid as DragSource.
I was trying this
foreach (Infragistics.Silverlight.Controls.Row row in igGridTransactions.Rows){ DragSource dragSource = new DragSource { IsDraggable = true, DataObject = row }; dragSource.Drop += new EventHandler<DropEventArgs>(dragSource_Drop); DragDropManager.SetDragSource(row, dragSource);}This line will not compile because row is not a DependencyObjectDragDropManager.SetDragSource(row, dragSource);How can I accomplish this?Any help would be greatly appreciated.
Is it possible with the Drag and Drop API to drag a single row instead of the whole grid? I need the ability to drag a row to a XamWebTree. I'm open to xaml or code-behind. If I set my grid like this...
<igGrid:XamWebGrid Name="igGrid" AutoGenerateColumns="False"> <ddm:DragDropManager.DragSource> <ddm:DragSource IsDraggable="True" DragChannels="test"> <!-- <ddm:DragSource.DragTemplate> <DataTemplate x:Name="dragTemplate"> <StackPanel Orientation="Horizontal" Margin="-5"> <TextBlock Width="150" FontSize="11" Margin="5" Text="{Binding ????}" /> <TextBlock Width="100" FontSize="11" Margin="5" Text="{Binding ????}" /> </StackPanel> </DataTemplate> </ddm:DragSource.DragTemplate> --> </ddm:DragSource> </ddm:DragDropManager.DragSource>
This code will drag the whole grid. I was playing around with the DragSource.DragTemplate but I couldn't figure that out as I'm not sure how to bind to a column of the currently selected row.
I gave up on this and then attempted to do code-behind. But I can't figure out how to set the Row as a DragSource as it doesn't fit your SetDragSource method signature.
foreach (Infragistics.Silverlight.Controls.Row row in igGridTransactions.Rows){ DragSource dragSource = new DragSource { IsDraggable = true, DataObject = row }; dragSource.Drop += new EventHandler<DropEventArgs>(OnDrop); DragDropManager.SetDragSource(row, dragSource); // won't compile}Surely it can't be this hard to make a grid row draggable?Please help!