I need to go through the entire collection of elements/controls on the grid.. I am using the following piece of code
public void clear_all(Grid g)
UIElementCollection cc = g.Children;
foreach (Control ctrl in cc)
if (ctrl.GetType() == typeof(TextBox))....etc
However during runtime the statement "foreach (Control ctrl in cc)" throws an error for the image control. The error message reads "Unable to cast object type system.windows.controls.image into system.windows.controls.control".....
This is urgent and I need to fix this right away! all help is greatly appreciated.. Thanks!