Back to Devexpress

RepositoryItemGridLookUpEditBase.PopupView Property

windowsforms-devexpress-dot-xtraeditors-dot-repository-dot-repositoryitemgridlookupeditbase-d812f9c1.md

latest5.2 KB
Original Source

RepositoryItemGridLookUpEditBase.PopupView Property

Gets or sets the View used to represent data in the dropdown.

Namespace : DevExpress.XtraEditors.Repository

Assembly : DevExpress.XtraGrid.v25.2.dll

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

Declaration

csharp
[DXCategory("View")]
public ColumnView PopupView { get; set; }
vb
<DXCategory("View")>
Public Property PopupView As ColumnView

Property Value

TypeDescription
ColumnView

A ColumnView descendant that is currently used to represent data in the dropdown.

|

Remarks

By default, this property is set to an instance of the GridView class. You can change the View type using one of the following methods:

After you switch the View type, you may need to perform additional customizations of the created View. For instance, after you activate the BandedView or AdvBandedView format, you need to manually create bands and add columns to the bands. Otherwise, these Views cannot display data.

At design time, you can customize the View with the Data Grid Designer. To open the designer, do one of the following:

  • click the ellipsis button for the PopupView property in Properties grid.
  • invoke the Designer View command from the Properties window or the control’s smart tag.

It’s not possible to share a single View between multiple LookUp editors and grid controls.

Note

You can use the Grid Control and View’s methods only when the drop-down window is open if you want to access the data source and calculated data. To access the View, handle the QueryPopUp or Popup event.

csharp
private void gridLookUpEdit1_Properties_QueryPopUp(object sender, CancelEventArgs e) {
   // Cast to SearchLookUpEdit or GridLookUpEdit depending on which control you use
   GridLookUpEdit gridLookUpEdit = sender as GridLookUpEdit;
   gridLookUpEdit.Properties.PopupView.Columns["ID"].Visible = false;
}
vb
Private Sub gridLookUpEdit1_Properties_QueryPopUp(ByVal sender As Object, ByVal e As CancelEventArgs)
   ' Cast to SearchLookUpEdit or GridLookUpEdit depending on which control you use
   Dim gridLookUpEdit As GridLookUpEdit = TryCast(sender, GridLookUpEdit)
   gridLookUpEdit.Properties.PopupView.Columns("ID").Visible = False
End Sub

When the drop-down window is closed, use the data source’s methods.

If you customize the View in an event, do not use objects to identify the View, columns, and so on – use field names, captions, etc., instead. The example below shows how to identify a column in a CustomDrawCell event handler.

csharp
private void SearchLookUpEdit1View_CustomDrawCell(object sender, >DevExpress.XtraGrid.Views.Base.RowCellCustomDrawEventArgs e) {
   if (e.Column.FieldName == "MyFieldName") {
       //...
   }
}
vb
Private Sub SearchLookUpEdit1View_CustomDrawCell(ByVal sender As Object, ByVal >e As DevExpress.XtraGrid.Views.Base.RowCellCustomDrawEventArgs) _
   Handles searchLookUpEdit1View.CustomDrawCell
   If e.Column.FieldName = "MyFieldName" Then
       '...
   End If
End Sub

See Also

PopupViewType

RepositoryItemGridLookUpEditBase Class

RepositoryItemGridLookUpEditBase Members

DevExpress.XtraEditors.Repository Namespace