packages/Windows API Code Pack 1.1/source/WindowsAPICodePack/Shell/CommonFileDialogs/CommonFileDialogControlCollection.cs
/// <summary>
/// Recursively searches for a given control id in the 
/// collection passed via the <paramref name="controlCollection"/> parameter.
/// </summary>
/// 
/// <param name="controlCollection">A Collection&lt;CommonFileDialogControl&gt;</param>
/// <param name="id">An int containing the identifier of the control 
/// being searched for.</param>
/// 
/// <returns>A DialogControl who's Id matches the value of the
/// <paramref name="id"/> parameter.</returns>
/// 
Recursively searches for a given control id in the
collection passed via the

parameter.
Recursively searches for a given control id in the collection passed via the parameter .
internal DialogControl GetSubControlbyId(IEnumerable<DialogControl> controlCollection, int id)
        {
            if (controlCollection == null) { return null; }
            foreach (DialogControl control in controlCollection)
            {
                if (control.Id == id) { return control; }
                CommonFileDialogGroupBox groupBox = control as CommonFileDialogGroupBox;
                if (groupBox != null)
                {
                    var temp = GetSubControlbyId(groupBox.Items, id);
                    if (temp != null) { return temp; }
                }
            }
            return null;
        }
internal DialogControl GetSubControlbyId ( IEnumerable < DialogControl > controlCollection , int id ) { if ( controlCollection == null ) { return null ; } foreach ( DialogControl control in controlCollection ) { if ( control . Id == id ) { return control ; } CommonFileDialogGroupBox groupBox = control as CommonFileDialogGroupBox ; if ( groupBox != null ) { var temp = GetSubControlbyId ( groupBox . Items , id ) ; if ( temp != null ) { return temp ; } } } return null ; }
Recursively searches for a given control id in the
collection passed via the
Recursively searches for a given control id in the collection passed via the
// if ctrlColl is null, it will throw in the foreach. // Search GroupBox child items
A DialogControl who's Id matches the value of the
parameter.
A DialogControl who ' s Id matches the value of the parameter .
controlCollection
IEnumerable<DialogControl>
None
id
int
An int containing the identifier of the control
being searched for.
An int containing the identifier of the control being searched for .