WPF: Is there a "ListBox" without the ability to select items?
Basically I want something like the old VB 6 DataRepeater, where every item in a collection is bound to a template. The only feature I want the container to have is scrolling and data-binding, the other stuff like being able to s开发者_Python百科elect items just gets in the way.
P.S. If you can't recommend anything I'm just going to use a stack panel and manually create/destroy the objects as necessary.
Use an ItemsControl.
Set the ItemsControl.ItemsPanel to contain a StackPanel with ScrollViewer.ScrollBars set, if you have lots of Items in your collection use a VirtualizingStackPanel for better performance.
Each item can be templated in with the ItemsControl.ItemTemplate.
See ItemsControl for more info and an example
精彩评论