C
C#7mo ago
olleeee

✅ WPF, how do i fill listboxes with values

Hi im trying to fill my list with objects and then only display the name what should i do?
public void FillLists(Wizard wizard)
{

lstGryffindor.ItemsSource = hogwarts.Griffendor.Members;
lstHufflepuff.ItemsSource = hogwarts.Hufflepuff.Members;
lstRavenclaw.ItemsSource = hogwarts.Ravenclaw.Members;
lstSlytherin.ItemsSource = hogwarts.Slytherin.Members;

}
public void FillLists(Wizard wizard)
{

lstGryffindor.ItemsSource = hogwarts.Griffendor.Members;
lstHufflepuff.ItemsSource = hogwarts.Hufflepuff.Members;
lstRavenclaw.ItemsSource = hogwarts.Ravenclaw.Members;
lstSlytherin.ItemsSource = hogwarts.Slytherin.Members;

}
4 Replies
olleeee
olleeee7mo ago
BlazeBin - xslhmxzcxjtf
A tool for sharing your source code with the world!
olleeee
olleeee7mo ago
so i have created wizards and they have certain attributes. I then created a sorting hat to sort the wizards into different studentshomes in Hogwarts. What i now want to do is print out this into listboxes in my interface and only display the names, but the attributes should still be there.
olleeee
olleeee7mo ago
BlazeBin
A tool for sharing your source code with the world!
olleeee
olleeee7mo ago
at the moment only griffendor wizards get displayed in the list and only one wizard can be added... okey got that sorted he he, still need help with just printing out the name though