问题描述
我有一个 ListBox,我用 WrapPanel 替换了它的 ItemsPanel.WrapPanel 现在托管数据绑定的 ListboxItems.每个项目都有一个可变大小的文本,为每个项目提供不同的宽度.但是,我希望宽度保持不变,以便所有项目与具有最长文本的项目具有相同的宽度.这可能吗?
I have a ListBox whose ItemsPanel I have replaces with a WrapPanel. The WrapPanel now hosts the databound ListboxItems. Each item has a variable sized text in it, giving each item a different width. However, I want the width to be constant so that all items have the same width as the item with the longest text. Is that possible?
推荐答案
将每个项目放置在单行单列(自动宽度)网格中,并为列命名.在 ListBox 上设置 Grid.IsSharedSizeScope,所有网格都将具有相同的宽度.
Place each item in a single-row, single-column (auto width) grid, and name the column. Set Grid.IsSharedSizeScope on the ListBox and all grids will have the same width.
这篇关于WPF WrapPanel - 所有项目应具有相同的宽度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!


大气响应式网络建站服务公司织梦模板
高端大气html5设计公司网站源码
织梦dede网页模板下载素材销售下载站平台(带会员中心带筛选)
财税代理公司注册代理记账网站织梦模板(带手机端)
成人高考自考在职研究生教育机构网站源码(带手机端)
高端HTML5响应式企业集团通用类网站织梦模板(自适应手机端)