I have a UserControl
that I made with a few Label
s to show information from a custom class I wrote, that has fields which hold the data the Label
s must display.
I will have a collection of objects of said class and I want to display them on my WPF window one below the other in a horizontal fashion.
I thought to use a StackPanel
, as I don't know too much about WPF to think of other controls that could do that. So I looked around for a way to bind a collection to a StackPanel
.
I found those questions: Q1, Q2 and Q3
However simply placing my UserControl
in the DataTemplate
doesn't work and I don't know how to tell WPF - take this collection of objects and tie each object to an instance of my UserControl
and stack those in this StackPanel.
I would, rather strongly, prefer to use mainly XAML for this, so an answer with WPF Data Binding would be greatly appreciated, thank you!