Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个 ListBox,我用 WrapPanel 替换了它的 ItemsPanel。WrapPanel 现在托管数据绑定的 ListboxItems。每个项目都有一个可变大小的文本,为每个项目提供不同的宽度。但是,我希望宽度保持不变,以便所有项目与具有最长文本的项目具有相同的宽度。那可能吗?
将每个项目放在单行、单列(自动宽度)网格中,并命名该列。在 ListBox 上设置 Grid.IsSharedSizeScope,所有网格都将具有相同的宽度。