Imports Telerik.WinControls
Imports Telerik.WinControls.UI

Public Class RadForm1

    Private Sub RadForm1_Load(sender As Object, e As EventArgs) Handles Me.Load
        Create_List()
        update_list()
    End Sub

    Public Sub Create_List()
        RadListView1.Items.Clear()

        RadListView1.Columns.Add(New ListViewDetailColumn("CollID") With {.Width = 30, .Visible = False})
        RadListView1.Columns.Add(New ListViewDetailColumn("tGuid") With {.Width = 130, .Visible = False})
        RadListView1.Columns.Add(New ListViewDetailColumn("Sign") With {.Width = 20, .HeaderText = "", .Visible = True})
        RadListView1.Columns.Add(New ListViewDetailColumn("TM") With {.Width = 70})
        RadListView1.Columns.Add(New ListViewDetailColumn("Sp") With {.Width = 50})
        RadListView1.Columns.Add(New ListViewDetailColumn("Type") With {.Width = 150})

    End Sub

    Private Sub RadListView1_CellFormatting(sender As Object, e As ListViewCellFormattingEventArgs) Handles RadListView1.CellFormatting
        e.CellElement.ImageLayout = ImageLayout.Zoom '--- this code resize the .svg file from column "Sign"

        Dim cell As DetailListViewCellElement = TryCast(e.CellElement, DetailListViewCellElement)

        If cell.Data.HeaderText <> "TM" Then
            Return
        End If

        If cell.Text.StartsWith("TM1") Then
            cell.GradientStyle = GradientStyles.Solid
            cell.BackColor = Color.Red
        ElseIf cell.Text.StartsWith("TM4") Then
            cell.GradientStyle = GradientStyles.Solid
            cell.BackColor = Color.Blue
        Else
            cell.ResetValue(LightVisualElement.GradientStyleProperty, ValueResetFlags.Local)
            cell.ResetValue(LightVisualElement.BackColorProperty, ValueResetFlags.Local)
        End If
    End Sub

    Private Sub RadListView1_SelectedItemChanged(sender As Object, e As EventArgs) Handles RadListView1.SelectedItemChanged
        If RadListView1.Visible Then
            '---Some code here
        End If
    End Sub

    Public Sub update_list()
        Dim i As Integer

        For i = 1 To 5
            Dim Item As New ListViewDataItem()
            Item(0) = "ID" & i
            Item(1) = "Guid" & i
            Item(2) = ""
            Item.Image = My.Resources.ResourceManager.GetObject("red_cross")
            Item(3) = "TM" & i
            Item(4) = "Sp" & i
            Item(5) = "Type" & i
            RadListView1.Items.Add(Item)
        Next

    End Sub

End Class
