Since I am pretty new to WPF FlowDocuments I would like to ask if the code below is correct. It is supposed to return all Images contained in a FlowDocument as List:
static IEnumerable GetElementsOfType(DependencyObject parent) where T : class
{
var childElements = LogicalTreeHelper.GetChildren(parent).OfType().ToList();
return childElements.SelectMany(GetElementsOfType).Union(childElements.OfType());
}
....
var images = GetElementsOfType(document)