I have trying to display list of thumbnail image use ListView. I have followed the guide on documentation http://www.telerik.com/help/winforms/listview-custom-items.html but my thumbnail list does not display correct. Please view result and my code.
Public Class MyCustomVisualItem
Inherits SimpleListViewVisualItem
Private imageelement As RadImageItem
Private stackLayout As StackLayoutPanel
Protected Overrides Sub CreateChildElements()
MyBase.CreateChildElements()
Me.stackLayout = New StackLayoutPanel()
Me.stackLayout.Orientation = Orientation.Horizontal
Me.stackLayout.EqualChildrenWidth = True
Me.imageelement = New RadImageItem
' Me.imageelement.
Me.imageelement.MinSize = New Size(120, 120)
Me.stackLayout.Children.Add(Me.imageelement)
Me.Children.Add(Me.stackLayout)
End Sub
Protected Overrides Sub SynchronizeProperties()
MyBase.SynchronizeProperties()
Me.Text = ""
Dim myId As Decimal = CType(Me.Data.DataBoundItem, Decimal)
Me.imageelement.Image = loadThumbnail(myId)
'Me.contentElement.Text = Convert.ToString(Me.Data("Name"))
'Me.buttonElement1.Text = "Call " + Convert.ToString(Me.Data("Phone"))
'Me.buttonElement2.Text = "Fax " + Convert.ToString(Me.Data("Fax"))
End Sub
Protected Overrides ReadOnly Property ThemeEffectiveType() As Type
Get
Return GetType(SimpleListViewVisualItem)
End Get
End Property
Private Function loadThumbnail(ByVal iD As Decimal) As Image
Dim temp As Byte() = (From cont In Program.travel_context.images _
Where cont.image_id = iD _
Select cont.icon).First
Dim temp_image As Image = Image.FromStream(New MemoryStream(temp))
Return temp_image
End Function
End Class