Hi,
When using custom sorting you need to render the sorting glyph with your own implementation. This is not handled by the grid. This is by design. You need to create an implementation of CellFactory to achieve this.
Public Class SortCellFactory
Inherits CellFactory
Public Overrides Sub CreateColumnHeaderContent(grid As C1FlexGrid, bdr As Border, range As CellRange)
Dim col = grid.Columns(range.Column)
MyBase.CreateColumnHeaderContent(grid, bdr, range)
If (col.Tag IsNot Nothing) Then
If col.Tag.ToString() = "D" Then
Dim header As New Grid()
Dim tb As New TextBlock()
If bdr.Child IsNot Nothing Then
tb = TryCast(bdr.Child, TextBlock)
End If
bdr.Child = Nothing
tb.HorizontalAlignment = HorizontalAlignment.Left
tb.VerticalAlignment = VerticalAlignment.Center
header.Children.Add(tb)
Dim sort As New Polygon()
sort.Fill = Brushes.Black
sort.FillRule = FillRule.EvenOdd
sort.HorizontalAlignment = HorizontalAlignment.Right
sort.VerticalAlignment = VerticalAlignment.Center
sort.Points = New PointCollection(New List(Of Point)() From {
New Point(0, 4),
New Point(8, 4),
New Point(4, 0)
})
header.Children.Add(sort)
bdr.Child = header
ElseIf col.Tag.ToString() = "A" Then
Dim header As New Grid()
Dim tb As New TextBlock()
If bdr.Child IsNot Nothing Then
tb = TryCast(bdr.Child, TextBlock)
End If
tb.HorizontalAlignment = HorizontalAlignment.Left
tb.VerticalAlignment = VerticalAlignment.Center
bdr.Child = Nothing
header.Children.Add(tb)
Dim sort As New Polygon()
sort.HorizontalAlignment = HorizontalAlignment.Right
sort.VerticalAlignment = VerticalAlignment.Center
sort.Fill = Brushes.Black
sort.FillRule = FillRule.EvenOdd
sort.Points = New PointCollection(New List(Of Point)() From {
New Point(0, 0),
New Point(8, 0),
New Point(4, 4)
})
header.Children.Add(sort)
bdr.Child = header
ElseIf col.Tag.ToString() = "" Then
Dim header As New Grid()
Dim tb As New TextBlock()
If bdr.Child IsNot Nothing Then
tb = TryCast(bdr.Child, TextBlock)
End If
tb.HorizontalAlignment = HorizontalAlignment.Left
tb.VerticalAlignment = VerticalAlignment.Center
bdr.Child = Nothing
header.Children.Add(tb)
Dim sort As New Polygon()
sort.HorizontalAlignment = HorizontalAlignment.Right
sort.VerticalAlignment = VerticalAlignment.Center
sort.Fill = Brushes.Black
sort.FillRule = FillRule.EvenOdd
sort.Points = New PointCollection(New List(Of Point)() From {
New Point(0, 0),
New Point(8, 0),
New Point(4, 4)
})
'header.Children.Add(sort)
bdr.Child = header
End If
End If
End Sub
End Class
Please refer the attached sample with complete implementation.
~nilay