I know i can use LogicalTreeHelper
class to find children node for every element searching it by name. But is there a possibility to find a child node by Type? For example, what if i would like to find a ListBox element in my Window without knowing its Name property??
views:
228answers:
2
A:
I don't think that there is a built in way of doing this. Probably the best approach would be to recursively call LogicalTreeHelper.GetChildren()
until a child control of the specified type is found.
Andy
2009-02-24 17:22:09
A:
Note that descending the Logical tree cleanly is actually a little tricky, here's a nice article on the intricacies of both the visual and logical trees.
I don't think any helper code exists to do this for you so implementing a recursive walk over the tree is required.
ShuggyCoUk
2009-02-24 20:36:27