Hi,@Don Baechtel. Welcome Microsoft Q&A.
Not sure what your Mode class is. I'm using the following code that shows the name.
Method 1:
Xaml:
<StackPanel Orientation="Horizontal">
<Label Content="Mode:" Margin="10,10,10,10" FontSize="30" FontWeight="Bold"/>
<ListBox SelectionMode="Single" MaxHeight="130" ItemsSource="{Binding}" DataContext="{StaticResource modes}"
ScrollViewer.VerticalScrollBarVisibility="Visible">
</ListBox>
</StackPanel>
Code:
public class Mode
{
public string Name { get; set; }
public Mode() { }
public override string ToString()
{
return Name;
}
}
The result:
Update:
Method 2: As Limitless Technology said, you could use templates and it works fine.
<StackPanel Orientation="Horizontal">
<Label Content="Mode:" Margin="10,10,10,10" FontSize="30" FontWeight="Bold"/>
<ListBox SelectionMode="Single" MaxHeight="130" ItemsSource="{Binding}" DataContext="{StaticResource modes}"
ScrollViewer.VerticalScrollBarVisibility="Visible">
<ListBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Name}" />
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</StackPanel>
Mode:
public class Mode
{
public string Name { get; set; }
public Mode() { }
}
The result:
-
If the response is helpful, please click "Accept Answer" and upvote it.
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.