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

Insert position calculates improperly for expanded TreeViewItem #103

Closed
ihormelnyk opened this issue Jun 26, 2014 · 3 comments
Closed

Insert position calculates improperly for expanded TreeViewItem #103

ihormelnyk opened this issue Jun 26, 2014 · 3 comments
Milestone

Comments

@ihormelnyk
Copy link

Expanded TreeViewItem height includes child items also. So insert position should be calculated according to tree node itself but not whole tree item with sub nodes.

@hairybreeches
Copy link

We are experiencing this problem too.

To reproduce:

  1. Run the "defaults" example and switch to the tab labeled Issue Drag&Drop doesn't working on treeview subitems #65.
  2. Drag item 0 over the expanded element Root 1.

Notice that wherever you hold item 0 over Root 1, you will always get the "insert" adorner, never the "add" adorner.

However, if you:

  1. drag item 1 onto item 0, to add it.
  2. expand item 0 (it should have one child)
  3. drag item 2 over item 0.

Notice that in this case it is possible to get the "add" adorner.

When an expanded node has a small amount of children (seems like less than 3), it seems like it behaves roughly normally.

However, when it has a larger amount of children, it seems like the InsertPosition is never set to be RelativeInsertPosition.TargetItemCenter, and so we never get the add adorner, only the insert adorner. This could well be a result of the problem noted above.

Is a fix for this issue in the works, or would you appreciate a pull request?

@punker76
Copy link
Owner

@hairybreeches i'll take a look

@hairybreeches
Copy link

Thanks! It looks like @ihormelnyk is right, it's because the WPF item's height includes its children.

Although there's no really nice way to get the "true" item's height, when I use the solution outlined here

http://stackoverflow.com/questions/3354388/how-to-get-databound-treeviews-selected-treeviewitems-header-section-height-wit

I get the behaviour I would expect, albeit with a bit of weird behaviour on the bottom border.

@punker76 punker76 added this to the v1.1.0 milestone Jan 17, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants