回复 1楼willsHuang的帖子
你好,非常感谢你的问题反馈。
我现在的工作环境没有该控件,但是还是帮你查找了一下解决方法。
代码运行效果我没有确认,非常抱歉,你可以参照如下代码,试一试
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim template1 As Template = Template.CreateGridTemplate(2)
GcMultiRow1.Template = template1
GcMultiRow1.RowCount = 10
GcMultiRow1.AllowUserToAddRows = False
Dim r As New Random()
For i As Integer = 0 To GcMultiRow1.RowCount - 1
GcMultiRow1.SetValue(i, 0, r.[Next](1, 3))
GcMultiRow1.SetValue(i, 1, r.[Next](1, 100))
Next
End Sub
Private Sub GcMultiRow1_CellClick(ByVal sender As Object, ByVal e As CellEventArgs) Handles GcMultiRow1.CellClick
If e.Scope = CellScope.ColumnHeader Then
Dim chCell As ColumnHeaderCell = GcMultiRow1.ColumnHeaders(0).Cells(e.CellIndex)
If chCell.SortGlyphDirection = SortOrder.Ascending Then
chCell.SortGlyphDirection = SortOrder.Descending
Else
chCell.SortGlyphDirection = SortOrder.Ascending
End If
Dim si0 As SortItem = New SortItem(0, SortOrder.None)
Dim si1 As SortItem = New SortItem(1, SortOrder.None)
Select Case e.CellIndex
Case 0
si0.SortOrder = chCell.SortGlyphDirection
Exit Select
Case 1
si0.SortOrder = DirectCast(GcMultiRow1.ColumnHeaders(0).Cells(0), ColumnHeaderCell).SortGlyphDirection
si1.SortOrder = chCell.SortGlyphDirection
Exit Select
End Select
GcMultiRow1.Sort(New SortItem() {si0, si1})
End If
End Sub
如果不能解决你的需求,欢迎再次反馈。 |