下面的示例展示了如何最大化细节视图。 如果细节视图不存在,那么我们通过展开特定的主控行来创建它。 在我们的案例中,获取并使用与第一个主控行对应的细节视图。
在主控行被展开之后,通过 GridView.GetDetailView 方法获取细节视图。 然后使用 BaseView.ZoomView 方法最大化细节视图。 之后, detail 对象和 GridControl.DefaultView 属性都引用相同的已最大化的细节视图。
我们使用 GridControl.DefaultView 属性,按照“FUNCTION”列对细节数据行进行分组。| C# | 复制代码 |
|---|---|
int rowHandle = 0;
//Create the first detail by expanding a master row
GridView gView = gridControl1.MainView as GridView;
gView.SetMasterRowExpanded(rowHandle, true);
//Get the first detail
BaseView detail = gView.GetDetailView(rowHandle);
if (detail != null) {
detail.ZoomView();
//Access the detail via DefaultView
//Group by the FUNCTION column
(gridControl1.DefaultView as GridView).Columns["FUNCTION"].GroupIndex = 0;
}
| |
| Visual Basic | 复制代码 |
|---|---|
Dim rowHandle As Integer = 0
'Create the first detail by expanding a master row
Dim gView As GridView = CType(GridControl1.MainView, GridView)
gView.SetMasterRowExpanded(rowHandle, True)
'Get the first detail
Dim detail As BaseView = gView.GetDetailView(rowHandle)
If Not detail Is Nothing Then
detail.ZoomView()
'Access the detail via DefaultView
'Group by the FUNCTION column
CType(GridControl1.DefaultView, GridView).Columns("FUNCTION").GroupIndex = 0
End If
| |
