Tag Archives: find controls

Find controls by name in WPF with C#

This example lets you find controls by entering their names. When you enter a control’s name and a color and click Apply, the program changes the selected control’s background color. You can use XAML code to give names to the … Continue reading

Posted in controls, wpf | Tagged , , , , , , , , , | Comments Off on Find controls by name in WPF with C#

Loop over a form’s controls in C#

This example shows how to loop over controls of various types on a form. The Control class defines a Controls property that is a collection containing references to the controls inside a control. For example, a form’s Controls collection holds … Continue reading

Posted in controls, forms | Tagged , , , , , , , , , , , , | 3 Comments

Find controls by name in C#

This example shows how you can search a control hierarchy to find controls by name in C#. The following FindControl function does all of the work. It takes as parameters the parent control to check first and the name to … Continue reading

Posted in controls | Tagged , , , , , , , , | 3 Comments