The code is good, and I can't make it better or faster.
The foreach part can be slightly shorter.
or
The foreach part can be slightly shorter.
int i=1;
foreach (var item in w.ChildAll(cn: ctrlName)) {
print.it($"item={item}");
if (c == item)
break;
else
i++;
}
or