I have a DataGrid in a WPF application, right now when I click on a cell it highlights the whole row and when I then drag down the rows it highlights all of the rows in between.
What I need is for dragging over a row to copy the value from the cell you start on over all the rows you drag it over and only highlight the rows in the specific column.
The exact words in the request were "like Excel".
Is there a written control for this? I have searched SO and have not found exactly what I am looking for. If the control does not exist, what is a good starting place?
A good starting place for you to learn how to code Drag and Drop.
I recently created a treeview with Drag and Drop functionality.
You might get some ideas on how drag and drop works from this project.
You can download it here: https://drive.google.com/file/d/0B5WyqSALui0bYmJ4SkEzXzdmUk0/view?usp=sharing
If you need any help then feel free to ask....
Best of Luck.....
Related
I'm looking for a WPF drag drop library/article/tutorial that can:
Drag/drop to reorder list box items
Animate the panel as item is dragged (as shown in screen shot)
I've had a quick look at Telerik's DragDropManager, which comes with ListBoxDragDropBehavior. It provides drag/drop reordering, but not quite the behaviour as in my screenshot.
I would love to learn to write one from scratch eventually (adorners, animated panels, etc), but I'm currently time-constrained to using out-of-the-box libraries.
[edit]
The behaviour I'm looking for is the same as Windows 8's start screen
Check out Moving WPF DataGrid Rows using Drag and Drop which shows how to reorder DataGrid rows via drag drop and how to customize the drag indicator.
I am trying to find a way to drag and drop between two grids(NOT datagrids). Both grids have 3 columns and the second grid gets populated based on whats dropped from first grid and the rows on second grid are generated dynamically. First grid has custom controls as icons. I am unable to get the items on the first grid as row/column co-ordinates but the mouse event handler gives me the (x,y) point co-ordinatels. Is there an easy way of doing this?
Thanks.
If I understand correctly then the main problem you have is to get the control under your mouse cursor. You can get it by using either UIElement.InputHitTest or VisualTreeHelper.HitTest to get that control / visual. Also do check out this article on MSDN: Hit Testing in the Visual Layer - it is a well-written explanation of this process with examples.
I am working on an app where the user needs to be able to drag items from a datagrid onto a button (this then fires some data updates). After some messing around, I have this working quite well. I have used the DataGridDragDropTarget controls from the toolkit for this.
I now need to allow the user drag multiple rows at once. While the datagrid allows me to select multiple rows, the DataGridDragDropTarget will only drag the first of the selections.
It looks like the DataGridDragDropTarget is not built for multiple dragging.
Would be grateful for any help on this one, this is the first time I have posted on SO - and hoping you guys can come through for me.
Thanks all.
It will drag multiple rows for sure. I am sure you are doing same mistake as i did. I believe all your code are fine.
To drag multiple row click on one row press shift or ctrl to select multiple but "Note here: If you release your mouse click here before drag it will forget what are the multiple items it has selected", so just drag without leaving mouse on your last selected item.(So, I think it works that way without doing anything)
However I am also searching for someway to make it work like drag and drop as in desktop. ;-)
For example, dragging a row from a datagrid table to another datagrid table?
However the other datagrid table just present the row, it manipulates the data gathered and present it in its own way.
I am using wpf toolkit. Can show me a sample example on this?
Here is a good place to start. Although the tutorial is shown for ListBox, it can also be adapted for DataGrid (although I have not tried it for myself).
I'm trying to write a WPF control that has similar functionality to the Windows Sidebar.
The functionaly I would like to replicate is the drag and drop ordering. When dragging an item the other items move out of the way to show you where the item will end up when dropped.
Has anyone else had to implement this sort of functionality, if so how did you go about it?
I've been meaning to write something like that myself, but haven't quite gotten there yet. Take a look at Bea Stollnitz's drag and drop post. The insert adorner isn't the main focus of her post, but she discusses it.