Alternate height for rows

2 posts, 0 answers
  1. Manuel
    Manuel avatar
    3 posts
    Member since:
    Oct 2013

    Posted 08 Oct 2014 Link to this post

    I use a listview to display an image in a row and a description in another row. I'm trying to change the height of a smaller description but not work.

      
    Private Sub RadListView1_VisualItemFormatting(sender As Object, e As ListViewVisualItemEventArgs) Handles RadListView1.VisualItemFormatting
        e.VisualItem.ImageLayout = ImageLayout.Stretch
     
        If Convert.ToInt32(e.VisualItem.Tag) / 2 = 0 Then 'images
            e.VisualItem.BackColor = Color.Azure
            e.VisualItem.Size = New Size(950, 259)
        Else 'descripcion of image
            e.VisualItem.BackColor = Color.Black
            e.VisualItem.Font = New Font("Consolas", 20, FontStyle.Bold)
            e.VisualItem.Size = New Size(950, 50)
        End If
     
    End Sub
  2. George
    Admin
    George avatar
    500 posts

    Posted 13 Oct 2014 Link to this post

    Hi Manuel,

    Thank you for writing.

    Due to the virtualization in RadPageView visual items are being only created when needed and reused later on. In order to properly be able to mark certain items, you could use the Taproperty of the data items:
    e.VisualItem.Data.Tag

    Depending on where you are setting the tag, the way to set it would vary. For example, here is how to set it when creating an item:
    Dim dataItem As New ListViewDataItem()
    dataItem.Tag = 2

    I hope this helps.

    Regards,
    George
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  3. UI for WinForms is Visual Studio 2017 Ready
Back to Top