8

I have two lists of data. To represent an "item" I have a custom UserControl (as the item has multiple fields and I want to lay it out correctly on the UserControl).

I would like the list to be populated on some type of ListBox by these user controls instead of strings.

I have seen people do this in WPF using ItemsControl or some repeater. Do you know if there is any way to do this in WinForms?

I want to ensure that I get the proper vertical scrolling if the number of user controls is bigger than the container.

p.campbell
  • 98,673
  • 67
  • 256
  • 322
leora
  • 188,729
  • 360
  • 878
  • 1,366

2 Answers2

6

FlowLayoutPanel seems to do the job

p.campbell
  • 98,673
  • 67
  • 256
  • 322
leora
  • 188,729
  • 360
  • 878
  • 1,366
5

In .NET 3.5 SP1 the DataRepeater component was added to the framework as part of WinForms (rather than as part of the VB PowerPack downloadable add-on). If you're running on that version of the framework then it might do what you need.

Matt Hamilton
  • 200,371
  • 61
  • 386
  • 320
  • 2
    Thank you!!! This is a great discovery! Here is a link to a great tutorial of how to use it: http://blogs.msdn.com/b/vsdata/archive/2009/08/12/datarepeater-control-for-windows-forms.aspx – Gerhard Powell Apr 26 '12 at 15:37
  • if you can't find DataRepeater in latest editions of Visaul Studio, you can follow suggestions from [this post](http://stackoverflow.com/questions/34322344/vb-net-visual-basic-power-packs-not-working-on-vs2015) – ASh Feb 08 '17 at 07:54