public static class VisualTreeHelperExtensions
{
public static IEnumerable<T> FindVisualChilds<T>(this DependencyObject depObj)
where T : DependencyObject
{
if (depObj == null)
yield break;
for (int i = 0; i < VisualTreeHelper.GetChildrenCount(depObj); i++)
{
DependencyObject child = VisualTreeHelper.GetChild(depObj, i);
if (child is T tChild)
yield return tChild;