Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/visual-studio-2010/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Vb.net 获取DevExpress GridControl中主行和分组行的总数_Vb.net_Visual Studio 2010_Devexpress - Fatal编程技术网

Vb.net 获取DevExpress GridControl中主行和分组行的总数

Vb.net 获取DevExpress GridControl中主行和分组行的总数,vb.net,visual-studio-2010,devexpress,Vb.net,Visual Studio 2010,Devexpress,在我发布的一篇文章中,我发现了如何使用2个事件跟踪当前扩展的分组行: - gridview.GroupRowExpanded - gridview.GroupRowCollapsed 其中,我增加或减少一个整数,该整数跟踪当前展开的组行数。我现在要解决的问题是,如果用户展开或折叠所有组行,该怎么办。通过检查e.RowHandle,我目前知道这是何时完成的 我想知道是否有办法找到GridView中当前的组行总数(类似于普通行的rowcount),这样我就知道要将跟踪整数设置为多少 例如:

在我发布的一篇文章中,我发现了如何使用2个事件跟踪当前扩展的分组行:

 - gridview.GroupRowExpanded
 - gridview.GroupRowCollapsed
其中,我增加或减少一个整数,该整数跟踪当前展开的组行数。我现在要解决的问题是,如果用户展开或折叠所有组行,该怎么办。通过检查
e.RowHandle
,我目前知道这是何时完成的

我想知道是否有办法找到GridView中当前的组行总数(类似于普通行的rowcount),这样我就知道要将跟踪整数设置为多少

例如:

  • 如果我的当前计数为2,且组总数为15,则在触发“全部展开”时,当前计数设置为15,而不是3

展开时的每个细节都有自己的视图。因此,要获取主行数,可以使用MainView属性中的行数,如:

GridControl1.MainView.RowCount
要获取组行数,请执行以下操作:

    Dim Handle As Integer = -1  'group rows have negative row handles
    Do Until GridView1.GetRow(Handle) Is Nothing
        Handle -= 1
    Loop
    Dim count As Integer = Math.Abs(Handle + 1) 'number of group rows
或者,您可以使用您的数据源&linq,例如:

    Dim count As Integer = (From item As Class1 In List Group By item.Something Into AsEnumerable()).count

但据我所知,该行没有直接属性。

谢谢,但GridView1.GroupCount结果为“1”,无论展开多少组行,因为我只将其按一列分组。我想要GridView分组所依据的组行数,而不是列数。