HtmlContentControl.ForEach(Action<DxHtmlElement>, Predicate<DxHtmlElement>) Method
Performs an action on all or specific HTML elements.
Namespace: DevExpress.XtraEditors
Assembly: DevExpress.XtraEditors.v24.1.dll
NuGet Package: DevExpress.Win.Navigation
Declaration
public void ForEach(
Action<DxHtmlElement> action,
Predicate<DxHtmlElement> predicate = null
)
Parameters
Name | Type | Description |
---|---|---|
action | Action<DxHtmlElement> | An action to perform on HTML elements. |
Optional Parameters
Name | Type | Default | Description |
---|---|---|---|
predicate | Predicate<DxHtmlElement> | null | An optional parameter that specifies a condition to narrow the set of target items. |
Remarks
The action
parameter specifies an operation to execute on target HTML elements.
The optional predicate
parameter allows you to specify a condition that selects target HTML elements. If the predicate
parameter is missing, the action
is performed against all HTML elements.
The following code sets a background color for elements that belong to the ‘button’ class:
htmlContentControl.ForEach(x => x.Style.SetBackgroundColor(Color.Cornsilk), x => x.ClassName.Contains("button"));
See Also