在WPF中通过2个分支显示ListBox
我有一个列表框来显示数据源。数据源只有一个字段(“ClassName”)。 我希望列表框由 2 个分支显示。
示例:
类名:
类名1
类名2
类名3
ClassName4
显示: =>
类名1 类名2
ClassName3 ClassName4
请告诉我该怎么做! 谢谢!
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!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您必须将列表框的 ItemsPanel 更改为支持您想要的显示的内容。 WrapPanel 可能会工作得很好,但您必须使用自定义 listboxitem 样式来确保所有项目的宽度相同。您还可以使用包含 2 列的网格。但是,您必须指定每个项目所在的列,这可能很棘手。
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.