Skip to main content

ViewItem.CreateControl() Method

Creates a control that represents the current View Item in a UI.

Namespace: DevExpress.ExpressApp.Editors

Assembly: DevExpress.ExpressApp.v25.2.dll

NuGet Package: DevExpress.ExpressApp

Declaration

public void CreateControl()

Remarks

The Detail View (see ViewItem.View) automatically calls this method when the detail form is created. You do not have to call it manually.

When implementing a descendant of the ViewItem class, override the CreateControlCore method to create the required control. This method is called by the CreateControl method.

public class MyViewItem : ViewItem {
   protected override object CreateControlCore() {
      DevExpress.XtraEditors.LabelControl result = new DevExpress.XtraEditors.LabelControl();
      result.Dock = DockStyle.Fill;
      result.Text = Info.GetAttributeValue("Text");
      result.AutoSizeMode = LabelAutoSizeMode.Vertical;
      return result;
   }
}

To access the control returned by the Control property, use the ViewItem.Control property. If you need to execute a custom action when this control is created, use the CustomizeViewItemControl extension method.

See Also