4
Is there any way I can go through all the controls of a window and disable them? For example, do a foreach
that disables one by one of the controls. Something like below, only for WPF, and not Winforms.
private void HabilitarControles(bool habilita)
{
foreach (Control c in Controls)
{
c.Enabled = habilita;
foreach (Control con in c.Controls.OfType<Control>())
con.Enabled = habilita;
}
}
My controls are all on a grid. If I try to use this method, I get the error: "The name 'Controls' does not exist in the Current context"
– Mathi901
I’ve changed and I think it will. When it’s like that, you have to ask the question. We have no way of guessing the problems you’re having. But anyway, disable the
GridPanel
, is easier.– Maniero
Actually, disabling Grid is better. However, even using this in the code, it does not recognize Controls.
– Mathi901
Without a bigger context it’s hard to help.
– Maniero