-
-
Notifications
You must be signed in to change notification settings - Fork 410
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
DropInfo.InsertPosition Evaluation Issue #150
Comments
@pschimmel With which version does this happen? |
I'm using version 0.1.4.3 (.NET 4) |
@pschimmel so can you test the latest source? also avaialble via pre nuget. thx! |
I updated to version 1.0.0 Alpha 011 but still no luck. The changes I made are rather simple, maybe you could reproduce them in your environment (sorry for the sloppy programming style): I changed the XAML of the MainWindow under the "Bound TreeViews" tab as follows: <TreeView Grid.Column="0"
Grid.Row="1"
ItemsSource="{Binding TreeCollection}"
dd:DragDrop.IsDragSource="True"
dd:DragDrop.IsDropTarget="True"
dd:DragDrop.DropHandler="{Binding}"
dd:DragDrop.UseDefaultDragAdorner="True"> Then I changed the Data class: void IDropTarget.DragOver(IDropInfo dropInfo)
{
DragDrop.DefaultDropHandler.DragOver(dropInfo);
if ((dropInfo.Data is CustomDataModel) || dropInfo.TargetGroup == null) {
//dropInfo.Effects = System.Windows.DragDropEffects.None;
}
}
void IDropTarget.Drop(IDropInfo dropInfo)
{
DragDrop.DefaultDropHandler.Drop(dropInfo);
if (dropInfo.InsertPosition.HasFlag(RelativeInsertPosition.BeforeTargetItem))
MessageBox.Show("B-4"); // This is shown if example fails
var data = DefaultDropHandler.ExtractData(dropInfo.Data).OfType<GroupedItem>().ToList();
foreach (var groupedItem in data) {
groupedItem.Group = dropInfo.TargetGroup.Name.ToString();
}
if (dropInfo.TargetCollection is ICollectionView) {
((ICollectionView)dropInfo.TargetCollection).Refresh();
}
} If you drag Item 0 and drop it after Item 9 a MessageBox is shown although it should not have been. |
Thats because You can test it:
And output:
|
@pschimmel @kosorin Should be fixed with 3b0995c |
Hello!
I'm not sure if this is a bug of your library.
I have a TreeView with several hierarchical items. If I drop a item after the last item on the same level it should insert the item at the end of the list of subitems on this level.
However somehow the DropInfo.InsertPosition is evaluated wrong.
As you can see on the following screenshot the value of dropInfo.InsertPosition is AfterTargetItem as it should be. However it is still evaluated as BeforeTargetItem and the first line after the if is executed.
I also tried Enum.HasFlag with the same result.
Is there something I'm missing?
The text was updated successfully, but these errors were encountered: