I am using WPF .net 4.5 (c#) and I would like to make a ListBox that contains a series of user controls. (If a listbox is the wrong type of control, please let me know).
I want my listbox to have a copy of the user control as the list items, with different contents within each one.
How do I add user controls to a listbox?
Thanks for your help in advance!
You can set ItemTemplate for the listbox with your usercontrol in it.
<ListBox>
<ListBox.ItemTemplate>
<DataTemplate>
<local:UserControl1/>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
Thanks
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With