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

ItemsControlExtensions.GetClosest leads to a crash if an item in items is not an item of the itemsControl #179

Closed
haukepribnow opened this issue May 13, 2016 · 1 comment
Milestone

Comments

@haukepribnow
Copy link

haukepribnow commented May 13, 2016

ItemsControlExtensions.GetClosest contains this code:

  foreach (var i in items) {
    var uiElement = i as UIElement;

    if (uiElement != null) {
      var p = uiElement.TransformToAncestor(itemsControl).Transform(new Point(0, 0));

However, in some situations, the item i might not be a child of the itemsControl (for example when nesting ListBoxes containing draggable entries). In such a case, I got a InvalidOperationException from TransformToAncestor (with the German message "Das angegebene Visual-Objekt ist kein übergeordnetes Element dieses Visual-Objekts." which translates to: "The given Visual object is no ancestor of this Visual object.")

Therefore a fix should be implemented that makes sure that i is in fact a child of itemsControl.

@punker76 punker76 added this to the v1.0.0 milestone Aug 1, 2016
@punker76
Copy link
Owner

punker76 commented Aug 1, 2016

@haukepribnow This should be fixed with f877268

@punker76 punker76 closed this as completed Aug 1, 2016
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

2 participants