Skip to main content
All docs
V24.2

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

HtmlContentControl.ForEach(Action<DxHtmlElement>, Predicate<DxHtmlElement>) Method

Performs an action on all or specific HTML elements.

Namespace: DevExpress.XtraEditors

Assembly: DevExpress.XtraEditors.v24.2.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