WPF Identify UI Types in Grid
Sorry I didn't look at code close enough.You would have to have changed var to object and then done this:c.GetType().UnderlyingSystemType.Name == "TextBlock"..... That's the reflection way of doing it,...
View ArticleWPF Identify UI Types in Grid
Yes the LINQ solution is much better and one that us old time Reflection people sometimes forget!JP
View ArticleWPF Identify UI Types in Grid
var textBlocks = ingrid.Children.OfType<TextBlock>();"It's time to kick ass and chew bubble gum... and I'm all outta gum." - Duke Nukem
View ArticleWPF Identify UI Types in Grid
Hi,firstly, as one look into the object browser would have informed you, the base type for all Grid children would be UIElement, not Control, and second, you get at row and column indexes using...
View ArticleWPF Identify UI Types in Grid
Hi cunelson,please give us some more infoermation about what you are trying to do to help us pointing out other solutions.To see what is going on in your app try Snoop, a great tool."It's time to kick...
View ArticleWPF Identify UI Types in Grid
I ran my above example and receieved an error: Unable to cast object of type 'System.Windows.Controls.TextBlock' to type 'System.Windows.Controls.Control'. So I cahanged the code to:foreach (var c in...
View ArticleWPF Identify UI Types in Grid
Look at GetType().Name for the children example you show above. You can also enlist the visualTreeHelper is you want more than just the child controls.if(c.GetType().Name == "TextBox") ....JP
View ArticleWPF Identify UI Types in Grid
Is there a way to scroll through each control in a WPF grid and identyify the type of control? Such as:foreach (Control c ingrid.Children) { if (c.GetType() == [textblock, button, etc.] { [Do...
View Article