Completed
Last Updated: 08 Jun 2016 10:04 by ADMIN
ADMIN
Dess | Tech Support Engineer, Principal
Created on: 06 Jun 2016 12:14
Category: VirtualGrid
Type: Bug Report
0
FIX. RadVirtualGrid - custom cells are not applied when the column is pinned
Please refer to the attached gif file demonstrating how to reproduce the issue with the Demo application.

Workaround:

Public Class Form1
    Sub New()
        InitializeComponent()
        Me.RadVirtualGrid1.AllowAddNewRow = False
        Me.RadVirtualGrid1.AllowFiltering = False
        Me.RadVirtualGrid1.ColumnCount = 5
        Me.RadVirtualGrid1.MasterViewInfo.RegisterCustomColumn(3)     
        Me.RadVirtualGrid1.RowCount = 1
    End Sub
    Private Sub RadVirtualGrid1_CreateCellElement(sender As Object, e As VirtualGridCreateCellEventArgs) Handles RadVirtualGrid1.CreateCellElement
        Dim columnIndex As Integer = e.ColumnIndex
        If e.ViewInfo.ColumnsViewState.TopPinnedItems.Count > 0 AndAlso e.ColumnIndex - 1 < e.ViewInfo.ColumnsViewState.TopPinnedItems.Count Then
            columnIndex = e.ViewInfo.ColumnsViewState.TopPinnedItems(e.ColumnIndex - 1)
        End If

        If columnIndex = 3 AndAlso e.RowIndex >= 0 Then
            e.CellElement = New RedCellElement()
        End If
    End Sub

    Private Sub RadVirtualGrid1_CellValueNeeded(sender As Object, e As VirtualGridCellValueNeededEventArgs) Handles RadVirtualGrid1.CellValueNeeded
        e.Value = String.Format("{0}x{1}", e.RowIndex, e.ColumnIndex)
    End Sub
End Class

Class RedCellElement
    Inherits VirtualGridCellElement

    Sub New()
        MyBase.New()
    End Sub

    Private checkBox As RadCheckBoxElement
    Protected Overrides Sub CreateChildElements()
        MyBase.CreateChildElements()
        Me.checkBox = New RadCheckBoxElement()
        Me.Children.Add(Me.checkBox)
    End Sub

    Protected Overrides ReadOnly Property ThemeEffectiveType() As Type
        Get
            Return GetType(VirtualGridCellElement)
        End Get
    End Property

    Public Overrides Function IsCompatible(data As Integer, context As Object) As Boolean
        Dim headerRow As VirtualGridHeaderRowElement = TryCast(context, VirtualGridHeaderRowElement)
        If data >= 3 AndAlso headerRow Is Nothing Then
            Return True
        Else
            Return False
        End If
    End Function

    Protected Overrides Sub UpdateInfo(args As VirtualGridCellValueNeededEventArgs)
        MyBase.UpdateInfo(args)
        Me.NumberOfColors = 1
        Me.DrawFill = True
        Me.BackColor = Color.Red
    End Sub

End Class
0 comments