How to determine the element type in WPF programatically?
For example my xaml is consisting of textbox, radio buttons, combo's, list boxes etc.
In the load event, say I want to do something related to the controls.(Say for all textbox,
the foreground color will be red, for all labels the background color will be green)..
something of that sort.
So I have to loop through the entire list of controls present in the Xaml and then have to
write the control specific logic.
Is it by using Framework element?
Please give the code in c#. For example please take 3/4 controls of your choice.
I am also searching in google!
Thanks in advance
You can use:
if (element is Grid)
{
}
else if (element is Label)
...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With