I need to loop through all controls/elements and child controls/elements on a form and disable the control/element if the Tag property = "someText".
The following code works for controls and child controls on the form, but not for radRibbonBar elements.
=================================================
foreach (var control in GetControlHierarchy(this))
{
if (control.Tag != null)
{
if (control.Tag.Equals("someText"))
{
control.Enabled = false;
}
}
}
private IEnumerable<Control> GetControlHierarchy(Control root)
{
var queue = new Queue<Control>();
queue.Enqueue(root);
do
{
var control = queue.Dequeue();
yield return control;
foreach (var child in control.Controls.OfType<Control>())
queue.Enqueue(child);
} while (queue.Count > 0);
}
======================================================
How would I change the above code to include radRibbonBar elements?
Thank you,