在WPF中通过2个分支显示ListBox

发布于 2024-09-27 18:04:02 字数 217 浏览 0 评论 0原文

我有一个列表框来显示数据源。数据源只有一个字段(“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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

绿光 2024-10-04 18:04:02

您必须将列表框的 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文