''' ''' Applies Modifications to a certain type of controls ''' ''' ''' Dim oGridPatcher = New ClassControlPatcher(Of GridControl)(Me) ''' oGridPatcher. ''' ProcessContainer(AddressOf ClassGridControl.DefaultGridSettings). ''' ProcessContainer(AddressOf ClassGridControl.ReadOnlyGridSettings). ''' ProcessControl(AddressOf ClassGridControl.CheckboxSelectGridSettings, GridNotAssignedToParent). ''' ProcessControl(AddressOf ClassGridControl.CheckboxSelectGridSettings, GridAssignedToParent) ''' ''' The control to Patch Public Class ClassControlPatcher(Of T As Control) Private ReadOnly _Container As Control Public Sub New(Container As Control) _Container = Container End Sub Public Function ProcessContainer(Action As Action(Of T, Control)) As ClassControlPatcher(Of T) Return ProcessContainer(_Container, Action) End Function Public Function ProcessControl(Action As Action(Of T, Control), ByVal Control As Control) As ClassControlPatcher(Of T) Action(Control, _Container) Return Me End Function Private Function ProcessContainer(ByVal Container As Control, Action As Action(Of T, Control)) As ClassControlPatcher(Of T) For Each oControl As Control In Container.Controls If oControl.[GetType]() = GetType(T) Then Action(oControl, Container) Else ProcessContainer(oControl, Action) End If Next Return Me End Function End Class