Defines constants that inform ContainerControl.ValidateChildren(ValidationConstraints) about how it should validate a container's child controls.
By default, ContainerControl.ValidateChildren will validate all enabled controls in a container, such as a form. Use this enumeration to restrict the types of controls whose Control.Validating event is raised.
You can combine these enumerated values together with a bitwise OR operation. Combining parameters with a bitwise OR operator will result in a logical AND operation. For example, calling ValidateChildren(ValidationConstraints.ImmediateChildren | ValidationConstraints.Enabled) will only raise the Control.Validating event on controls that are both immediate children of the container AND are enabled.
If you do not specify ValidationConstraints.ImmediateChildren when you call ContainerControl.ValidateChildren(ValidationConstraints), the method will require that you validate all child controls in the control hierarchy.
Member Name | Description |
---|---|
Enabled |
Validates child controls whose Control.Enabled property is set to true. |
ImmediateChildren |
Validates child controls that are directly hosted within the container. Does not validate any of the children of these children. For example, if you have a System.Windows.Forms.Form that contains a custom System.Windows.Forms.UserControl, and the System.Windows.Forms.UserControl contains a System.Windows.Forms.Button, using ValidationConstraints.ImmediateChildren will cause the Control.Validating event of the System.Windows.Forms.UserControl to occur, but not the Control.Validating event of the System.Windows.Forms.Button. |
None |
Validates all child controls, and all children of these child controls, regardless of their property settings. |
Selectable |
Validates child controls that can be selected. |
TabStop |
Validates child controls that have a Control.TabStop value set, which means that the user can navigate to the control using the TAB key. |
Visible |
Validates child controls whose Control.Visible property is set to true. |