Skip to main content

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

BaseView.Assign(BaseView, Boolean) Method

Copies the settings of a View object to the current one.

Namespace: DevExpress.XtraGrid.Views.Base

Assembly: DevExpress.XtraGrid.v24.2.dll

NuGet Packages: DevExpress.Win.Grid, DevExpress.Win.Navigation

#Declaration

public virtual void Assign(
    BaseView v,
    bool copyEvents
)

#Parameters

Name Type Description
v BaseView

A BaseView object or descendant representing the source of the operation.

copyEvents Boolean

true if event handlers assigned to the source BaseView object should be assigned to the corresponding events of the destination View object; otherwise, false.

#Remarks

The Assign method is used to copy the settings of the BaseView object specified by the v parameter to the current View object. This method copies public properties of the source View object and, if the copyEvents parameter is true, the event handlers assigned. This makes it possible to have several View objects with the same behavior and appearance.

Note that the Assign method calls the BaseView.BeginUpdate and BaseView.EndUpdate methods before and after copying settings. Thus, you don’t need to call them manually.

Descendant Views override this method to implement proper assignment.

Note

If you copy settings to a grid control’s View before this grid’s data source is initialized, certain column settings (e.g., GridColumn.UnboundExpression of unbound columns) do not automatically take effect. You can use one of following solutions to resolve the issue:

  • Set the target grid’s data source after the Assign method is called.
  • Call the target View’s View.DataController.RePopulateColumns method after the Assign method is called.

More details can be found in this support ticket.

See Also