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

'System.Windows.Documents.Run' is not a Visual or Visual3D' Exception #17

Closed
punker76 opened this issue Feb 18, 2013 · 2 comments
Closed

Comments

@punker76
Copy link
Owner

Original author: manfred....@gmail.com (June 04, 2010 12:57:40)

Suddenly an unhandled Exception is thrown namely:
'System.Windows.Documents.Run' is not a Visual or Visual3D'

The exception occurs in
VisualTreeExtensions.cs in the Method GetVisualAncestor<T>(this
DependencyObject d) where T : class

To solve the problem I would add a check like so:
public static T GetVisualAncestor<T>(this DependencyObject d) where T :
class
{
if (d is Visual || d is System.Windows.Media.Media3D.Visual3D)
{
DependencyObject item = VisualTreeHelper.GetParent(d);

    while (item != null)
    {
        T itemAsT = item as T;
        if (itemAsT != null) return itemAsT;
        item = VisualTreeHelper.GetParent(item);
    }
}

return null;

}

Original issue: http://code.google.com/p/gong-wpf-dragdrop/issues/detail?id=17

@punker76
Copy link
Owner Author

From gro...@gmail.com on June 22, 2010 10:35:56
Could you give me more information about this issue please? Where is the Run defined? If you could provide a minimal XAML example that would be helpful.

@punker76
Copy link
Owner Author

From jbo...@gmail.com on February 14, 2011 17:16:39
I was having this problem too. But using a fix like this prevented me from dragging something that has a Run in it if the user clicks on the Run.
Here is a patch to fix it. The patch also updates to VS 2010 and dot net 4, but you can reverse the changes to the .csproj file if you don't want that.

punker76 pushed a commit that referenced this issue Feb 24, 2013
punker76 pushed a commit that referenced this issue Feb 24, 2013
Fix for issue #17 'System.Windows.Documents.Run' is not a Visual or Visual3D' Exception
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant