GetNamedElementsInScope trying to find visual children of non-ui element

Feb 1, 2011 at 6:58 PM

It was calling VisualTreeHelper.GetChildrenCount() on a DataGridColumn, resulting in a InvalidOperationException.

I don't know if it is applicable to the latest version located in BindingScope, but in my version of ExtensionMethods.cs the following fixed it...

from:

var childCount = VisualTreeHelper.GetChildrenCount(current);

to:

var childCount = (current is UIElement || current is UIElement3D ? VisualTreeHelper.GetChildrenCount(current) : 0);

Coordinator
Feb 1, 2011 at 7:54 PM

Is this WPF?

Feb 1, 2011 at 8:06 PM

Yes.

Coordinator
Feb 1, 2011 at 9:06 PM

It's always interesting to find out how the same API behaves differently between Silverlight and WPF ;) I'll try to get a fix in soon.

Coordinator
Feb 1, 2011 at 11:22 PM

Fixed in a7800b5e8b49