Search code examples
vb.netdatasetdevexpressxtragriddatarelation

Using DataRelations and DevExpress Grids - Hide expansion control


I have a bit of a weird issue. We use DevExpress controls to do all our Windows Form development. Anyway, I found a perfect use for the DataRow.SetParentRow/GetParentRow methods in my grid. So I created a DataRelation, added it to the DataSet and bound it as the data source for my grid. The issue is I now find this:

enter image description here

On my grid. It seems to be the DataRelation (when I mouse over it the tooltip is the DataRelation name).

Does anyone know how to hide this line of controls? If I cannot get rid of them I will have to write a parent/child link between the rows, and that would be a shame because the DataRelation stuff works almost perfectly.

Thanks in advance!


Solution

  • You want to set the following property to hide those: (this is for a grid view, banded grid view or advanced banded grid view)

    In OptionsDetail set EnableMasterViewMode=False

    If you have a master Detail grid that has times where the details are empty and you want to hide those you can do so by handling the custom draw for the masterview cells something like this:

    Private Sub gvMain_CustomDrawCell(ByVal sender As Object, ByVal e As DevExpress.XtraGrid.Views.Base.RowCellCustomDrawEventArgs) Handles gvMain.CustomDrawCell
        Dim View As DevExpress.XtraGrid.Views.Grid.GridView = CType(sender, DevExpress.XtraGrid.Views.Grid.GridView)
        If e.Column.VisibleIndex = 0 And View.IsMasterRowEmpty(e.RowHandle) Then
            CType(e.Cell, DevExpress.XtraGrid.Views.Grid.ViewInfo.GridCellInfo).CellButtonRect = Rectangle.Empty
        End If
    End Sub