The problem is you can't cast into a List(Of DivElement)
. The collection is a UIElementCollection
, not a List(Of T)
.
You could build a new list, though. This can also be simplified by using OfType
instead of casting manually:
Dim myList = spDivs.Children.OfType(Of DivElement)()
.Where(Function(o) o.ElementParent Is bComm)
.ToList()