Click here to Skip to main content
15,895,746 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have a simple XAML window with a grid that contains 30+ TextBlock controls, each with it's own tag defined at run time.

Is there an easy way to cycle through the controls on my form to do a comparison routine?

I had planned on going the route of...
VB
For Each Control in Me.Controls
     'if control is text block with a certain tag then...
Next
Posted
Updated 22-May-15 6:35am
v2

1 solution

 
Share this answer
 
Comments
Sean Donnahoe 22-May-15 19:04pm    
I have read both articles and am no where nearer my goal than before. I just want a way to cycle through the text blocks in my window and find the one who's tag property matches data from an XML file.
Sergey Alexandrovich Kryukov 22-May-15 23:09pm    
It means you read them in a wrong way. I used both trees extensively and know that they work. Now it's your time to pay some effort.
—SA
Sean Donnahoe 27-May-15 8:21am    
I'm not saying they don't work. I'm saying I don't understand any clearer. I am a fledgling coder. I don't know C#, but I am semi fluent in VB. I have used code converters online to understand C# better, but after reading the 2 articles, I still don't understand how to traverse the element tree.
Sergey Alexandrovich Kryukov 27-May-15 9:47am    
Okay, I see. But what choice do you have? I think, only getting to deeper understanding, if you even interested in that at all. This documentation is crystal clear. I mentioned "they work" not because I thought you questioned the WPF operation in relevant aspects, but just to assure you that I did not just push some documentation onto you in hope that you sort it out; I wanted to emphasize that you can actually read this documentation and solve your problem, which is confirmed by my real experience. Moreover, it was quite easy. Going through all the visual and logical trees (both) was something I actually needed. If I could do it, you can do it, too. If you think you have to had more experience, just get this experience.

You see, this is your turn now. You need to understand the API and try to use it. If you fail, ask some more specific question.

Thank you.

—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900