Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Copy function doesn't seem to work #162

Closed
MrBigDog2U opened this issue Feb 2, 2016 · 3 comments
Closed

Copy function doesn't seem to work #162

MrBigDog2U opened this issue Feb 2, 2016 · 3 comments
Assignees
Labels
Milestone

Comments

@MrBigDog2U
Copy link

I need to be able to drag-copy from a listbox and drop into another listbox and the code seems to imply that this should be possible but it either doesn't work or I'm misunderstanding how it should work.

Using the "Bound ListBoxes" example, the lower ListBox indicates that holding the Control key should result in a drag-copy operation but it behaves exactly the same regardless of the state of the Control key - always moving from one list to another.

It looks like the moveData boolean expression in DefaultDropHandler.Drop is just wrong. It also appears that the drag-copy behavior is incompletely implemented in general. I made some changes that made the drag-copy operation behave a little more like I would expect but, when I dragged the copied item back to the source listbox, it duplicated it (I suppose that's a possible interpretation of what should happen but not at all intuitive).

@punker76 punker76 added the Bug label Feb 3, 2016
@punker76 punker76 added this to the v1.0.0 milestone Feb 3, 2016
@punker76 punker76 self-assigned this Feb 3, 2016
@punker76
Copy link
Owner

punker76 commented Feb 3, 2016

@MrBigDog2U I'll fix this in the default drop handler by doing this

        var copyData = (dropInfo.DragInfo.DragDropCopyKeyState != default(DragDropKeyStates)) && dropInfo.KeyStates.HasFlag(dropInfo.DragInfo.DragDropCopyKeyState)
                       //&& (dropInfo.DragInfo.VisualSource != dropInfo.VisualTarget)
                       && !(dropInfo.DragInfo.SourceItem is HeaderedContentControl)
                       && !(dropInfo.DragInfo.SourceItem is HeaderedItemsControl)
                       && !(dropInfo.DragInfo.SourceItem is ListBoxItem);

for now, I don't know if we should prevent the copy action if target = source

@MrBigDog2U
Copy link
Author

I don't think that's right either. From this condition, if the SourceItem
is a ListBoxItem (or any of the other specified controls), then copyData
will be false regardless of the KeyStates. This means that you can never
copy a ListBoxItem.

My own expectations of what to do if (target == source) is that it would
never be a copy although I just checked Windows Explorer and, if you
ctrl-drag an item within a list in the right hand pane, it DOES do a copy.
So I don't know if preventing the copy on that condition is right either.

On Wed, Feb 3, 2016 at 8:01 AM, Jan Karger notifications@github.com wrote:

@MrBigDog2U https://github.com/MrBigDog2U I'll fix this in the default
drop handler by doing this

    var copyData = (dropInfo.DragInfo.DragDropCopyKeyState != default(DragDropKeyStates)) && dropInfo.KeyStates.HasFlag(dropInfo.DragInfo.DragDropCopyKeyState)
                   //&& (dropInfo.DragInfo.VisualSource != dropInfo.VisualTarget)
                   && !(dropInfo.DragInfo.SourceItem is HeaderedContentControl)
                   && !(dropInfo.DragInfo.SourceItem is HeaderedItemsControl)
                   && !(dropInfo.DragInfo.SourceItem is ListBoxItem);

for now, I don't know if we should prevent the copy action if target =
source


Reply to this email directly or view it on GitHub
#162 (comment)
.

@punker76
Copy link
Owner

punker76 commented Feb 3, 2016

the SourceItem is different to VisualSourceItem. this is directly ListBoxItem or TreeVieItem etc if you have an ItemsControl without ItemsSource binding. so copy this is limited for now, cause it's not an easy way to do this.

Von meinem iPhone gesendet

Am 03.02.2016 um 17:17 schrieb MrBigDog2U notifications@github.com:

I don't think that's right either. From this condition, if the SourceItem
is a ListBoxItem (or any of the other specified controls), then copyData
will be false regardless of the KeyStates. This means that you can never
copy a ListBoxItem.

My own expectations of what to do if (target == source) is that it would
never be a copy although I just checked Windows Explorer and, if you
ctrl-drag an item within a list in the right hand pane, it DOES do a copy.
So I don't know if preventing the copy on that condition is right either.

On Wed, Feb 3, 2016 at 8:01 AM, Jan Karger notifications@github.com wrote:

@MrBigDog2U https://github.com/MrBigDog2U I'll fix this in the default
drop handler by doing this

var copyData = (dropInfo.DragInfo.DragDropCopyKeyState != default(DragDropKeyStates)) && dropInfo.KeyStates.HasFlag(dropInfo.DragInfo.DragDropCopyKeyState)
//&& (dropInfo.DragInfo.VisualSource != dropInfo.VisualTarget)
&& !(dropInfo.DragInfo.SourceItem is HeaderedContentControl)
&& !(dropInfo.DragInfo.SourceItem is HeaderedItemsControl)
&& !(dropInfo.DragInfo.SourceItem is ListBoxItem);

for now, I don't know if we should prevent the copy action if target =
source


Reply to this email directly or view it on GitHub
#162 (comment)
.


Reply to this email directly or view it on GitHub.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants