WPF WrapPanel中 - 所有项目应具有相同的宽度宽度、项目、WPF、WrapPanel

由网友(我没变只是学会了坚强)分享简介:我有一个列表框的ItemsPanel我替换一个WrapPanel中。该WrapPanel中现在拥有数据绑定ListboxItems。每个项目中有一个可变大小的文字,给每个项目不同的宽度。但是,我想的宽度是恒定的,使得所有项具有相同的宽度具有最长文本的项目。这可能吗?I have a ListBox whose...

我有一个列表框的ItemsPanel我替换一个WrapPanel中。 该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?

推荐答案

将每个项目的单排,单柱(自动宽度)网格,并命名列。在列表框设置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.

阅读全文

相关推荐

最新文章