wpf controls – Display ListBox by 2 branches in WPF – Education Career Blog

I have a listbox to display a datasource. The datasource has only one field (“ClassName”).
I want the listbox is displayed by 2 branches.

Example:

ClassName:

ClassName1

ClassName2

ClassName3

ClassName4

Display: =>

ClassName1 ClassName2
ClassName3 ClassName4

Just tell me how to do that please!
thanks!

,

You’d have to change the Listbox’s ItemsPanel to something that supports the display that you want. The WrapPanel would probably work well, but you’d have to use a custom listboxitem style to ensure the width is the same for all items. You could also use a Grid with 2 columns. You’d have to specify the Column each item is in however, which might be tricky.

Leave a Comment