Is there any other way to do a multitouch drag and drop operation in WPF other than using SurfaceDragDrop? I'm currently using this as reference: http://msdn.microsoft.com/en-us/library/ee957380.aspx
The problem I have with SurfaceDragDrop:
It converts everything into a scatter item, which looks somewhat weird in my application context
The width and height of the dragged item seems to depend on where it's being dragged from - I can only drag it from a rather small area, but I need a bigger preview. Specifying the source as something bigger (i.e. the parent element) results either in a element thats too big or (/and) an element that's not under the touchpoint
Related
I'm working on a project using wpf.
The UI design is based on a tile system, where you can drag and drop tiles to specific locations.
The presentation of the tiles uses a customized TreeView that renders the items as Grids.
looking close to the rendered grid items i recognized that wpf renders the grid with shadows on the left and the right side.
Does anyone have an idea why there are shadows rendered? For a specific feature i have to color the bottom part of the grid red and it looks awkward cause of the rendered shadow.
Late to the party but for someone with same issue which seems to be the result of using Effect in the application like DropShadowEffect It solved my issue by adding following line to the Grid/Border ...
UseLayoutRounding="True"
I'm building a drag/drop application in winforms c#, i need to drag a usercontrol and drop it to a flowlayoutpanle.
everything works fine, except the drop location, the flowpanel sets the droped items side by side.
how can I set the droped item to the the exact cursor position?
I'll extend my comment to an answer.
The problem is not based on drag'n'drop. The problem is based on a semantic level. A flowlayoutpanel is used, to automatically arrange it's contents.
See MSDN FlowLayoutPanel Control Overview
The FlowLayoutPanel control arranges its contents in a horizontal or
vertical flow direction. You can wrap the control's contents from one
row to the next, or from one column to the next. Alternately, you can
clip instead of wrap its contents.
So the flowlayoutpanel-control does exactly what it's supposed to do. If you want to give the dropped control a specific location based on coordinates you want to use a normal panel. A normal panel will not arrange its contents automatically.
I'm building an application for users to create game terrain using hex tiles. I have a tree view with the various tile types and have successfully managed to load the images that I want to use (png's) into the tree as the node images.
I have used the code from here http://www.codeproject.com/Articles/14948/Hexagonal-grid-for-games-and-other-projects-Part as a basis for my project, although I have expanded it to allow for corner, and both "types" of half hexes.
What I want to accomplish is to drag a tile type from the Tile Catalogue tree view onto the hex grid drawn, and for that image to snap to the grid and align itself correctly. I imagine that the actual image to be drawn on the grid will end up being loaded separately as the treeview images are obviously very small versions of the original images.
Now I know there's a whole heap of items in there that I don't know how to do as yet but the first in the list is the drag and drop. All the searching I've done has turned up drag and drop examples for dragging within the treeview, or from one control to another and I'm not sure that those examples are relevant.
Can someone point me in the right direction to begin playing with this myself or give an example I could base what I need to do on?
Scenario:
I have several canvases on my page. Lets say that half of the canvases contains a draggable grid with a background. All the canvases and the draggable items are created in code-behind.
When I drag an object (grid) from one canvas to another it works fine. But the issue is that the dragged object does not always stay on top of all other objects.
Question:
How can I make the dragged object (Grid) stay on top of all others objects on the page?
I tried to use Canvas.SetZindex(obj, 1000), but that did not work.
Any suggestion would be appreciated.
You can use additional "Operational" canvas which should be a top in the elements hierarchy.
Each time when you start drag and drop, you should translate dragging object's position from the owner's coordinate to the additional canvas coordinate and move element to the additional canvas. The reverse workflow should be implemented on end drag.
So as result dragging object always will be on top while dragging
How can i create a canvas of this kind - http://www.silverdiagram.net/Projects/SilverDiagram/SilverDiagram_Demo.aspx? I want to position the controls exactly aligned to each other. I want to help users to align it properly using auto-alignment (like visual studio) and by providing user the scale.
The Canvas is the right container to use as you can position its child control by coordinates. Your problem is more about moving elements around, which is in fact drag & drop.
You'll have to handle mouse events: MouseDown to select an item, MouseMove to detect a drag and MouseUp to drop it. During the move or at the drop, you can change the element's coordinates to auto-align it on a grid or compared to surrounding elements.
I successfully made such a project in Silverlight and used Adorners to add resize handlers to the elements.
I solved the panning and zooming question by putting the Canvas into a Viewbox, which was in a ScrollViewer. If you want to let the user control the zoom factor, apply a LayoutTransform to the Canvas (available in the Toolkit).