Hi,@Roger Schlueter. Welcome to Microsoft Q&A. What is the code of your Widget class? You could try to refer to the sample code below to see if it helps you.
<ListBox ItemsSource="{Binding Widgets}"
SelectedValuePath="WidgetID"
DisplayMemberPath="Name" />
Codebehind:
Imports System.Collections.ObjectModel
Class MainWindow
Public Property Widgets As New ObservableCollection(Of Widget)()
Public Sub New()
InitializeComponent()
' Add some sample data to the collection
Widgets.Add(New Widget() With {.WidgetID = 1, .Name = "Widget 1"})
Widgets.Add(New Widget() With {.WidgetID = 2, .Name = "Widget 2"})
' Add more items as needed
DataContext = Me
End Sub
End Class
Public Class Widget
Public Property WidgetID As Integer
Public Property Name As String
' Other properties
End Class
The result:
If the problem still exists, can you share more code with me for analysis?
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.