GetNamedElementsInScope trying to find visual children of non-ui element

Feb 1, 2011 at 7: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...


var childCount = VisualTreeHelper.GetChildrenCount(current);


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

Feb 1, 2011 at 8:54 PM

Is this WPF?

Feb 1, 2011 at 9:06 PM


Feb 1, 2011 at 10: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.

Feb 2, 2011 at 12:22 AM

Fixed in a7800b5e8b49