Hello everyone :)
I've got a new project that includes a RadListView that I have placed on a WinForm with ViewType = IconsView
I'd like to display a thumbnail along with some HTML text - but I'm struggling getting the data I need from the object being formatted.
Here's my VisualItemFormatting method:
Private Sub rlvScanForms_VisualItemFormatting(sender As Object, e As Telerik.WinControls.UI.ListViewVisualItemEventArgs) Handles rlvScanForms.VisualItemFormattingDim myViewElement As RadListViewElement = CType(sender, RadListViewElement)
' .Item(0) IS WRONG!!! THiS IS just a place holder for my question to Telerik Forum members :)
If myViewElement.Items(0).Tag IsNot Nothing Then
Dim myScanFormIcon As ScanFormIcon = CType(myViewElement.Items(0).Tag, ScanFormIcon)
Dim myWidth As Integer = myScanFormIcon.IconSize.Width
Dim myHeight As Integer = myScanFormIcon.IconSize.Height
Dim myText As String = myScanFormIcon.DisplayString
If e.VisualItem.Data.Image IsNot Nothing Then
e.VisualItem.Image = e.VisualItem.Data.Image.GetThumbnailImage(myWidth, myHeight, Nothing, IntPtr.Zero)
e.VisualItem.Layout.RightPart.Margin = New Windows.Forms.Padding(2, 0, 0, 0)
End If
If rlvScanForms.ViewType = Telerik.WinControls.UI.ListViewType.IconsView Then
If myViewElement.Items(0).Tag IsNot Nothing Then
e.VisualItem.Text = myText
End If
End If
End If
myViewElement.Items(0).Tag holds a class that contains the text I'd like to display along with the correct icon size (these are documents of various sizes so I'd like the icons to have the same width/height ratio.
myViewElement.Items(0).Tag is clearly WRONG...it's there and not Nothing but it's the 0 index of all Items in the RadListView and it's in my code as a place holder so I could build the rest of the UI class.
Does anyone know how I can get the index of the ListViewItem that's being "formatted" by VisualItemFormatting? Of not the index from the RadListView's Item collection, maybe the actual ListViewItem object itself?
Any help would be appreciated.
Thank
Found it!