Mega Code Archive
Without specifying a DataTemplate, the ListBox displays a list of names
//File:Window.xaml.vb
Imports System.Collections.ObjectModel
Namespace WpfApplication1
Public Class Employee
Public Property FirstName() As String
Get
Return m_FirstName
End Get
Set
m_FirstName = Value
End Set
End Property
Private m_FirstName As String
Public Property Age() As Integer
Get
Return m_Age
End Get
Set
m_Age = Value
End Set
End Property
Private m_Age As Integer
Public Property Photo() As String
Get
Return m_Photo
End Get
Set
m_Photo = Value
End Set
End Property
Private m_Photo As String
Public Overrides Function ToString() As String
Return FirstName
End Function
End Class
Public Class People
Inherits Collection(Of Employee)
Public Sub New()
Me.Add(New Employee() With { _
.FirstName = "A", _
.Age = 26, _
.Photo = "a.png" _
})
Me.Add(New Employee() With { _
.FirstName = "C", _
.Age = 24, _
.Photo = "c.png" _
})
End Sub
End Class
End Namespace