© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•13mo ago•
3 replies
Mąż Zuzanny Harmider Szczęście

✅ Listbox issue

hey, having issues with a listbox template:
        <ListBox x:Name="PersonList" SelectionMode="Multiple">
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <StackPanel Orientation="Horizontal">
                        <Label Content="{Binding Name}"/>
                        <Label Content="{Binding Surname}"/>
                    </StackPanel>
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>
        <ListBox x:Name="PersonList" SelectionMode="Multiple">
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <StackPanel Orientation="Horizontal">
                        <Label Content="{Binding Name}"/>
                        <Label Content="{Binding Surname}"/>
                    </StackPanel>
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>

can you guys tell me what's wrong here?
public RemovePersonList(List<Person> personList)
{
  InitializeComponent();
  PersonList.ItemsSource = personList;
}
//How person class looks:
class Person{
public string Name;
public string Surname;
//...
}
public RemovePersonList(List<Person> personList)
{
  InitializeComponent();
  PersonList.ItemsSource = personList;
}
//How person class looks:
class Person{
public string Name;
public string Surname;
//...
}

The issue is that the items show up but they are empty
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

listbox display help !
C#CC# / help
3y ago
❔ ListBox Text OverFlow
C#CC# / help
3y ago
transport value in listbox of Form1 to Form5.listbox
C#CC# / help
3y ago