You could wrap each item in a Grid
, and use the Grid's ShareSizeScope
property to make sure all items share the same width.
For example, on your WrapPanel you would set Grid.IsSharedSizeScope
to true
<WrapPanel Grid.IsSharedSizeScope="True">
Then you'd wrap each item in a single cell Grid
that uses the SharedSizeGroup
property to tell them that they all share a size
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition SharedSizeGroup="SharedGroup" />
</Grid.ColumnDefinitions>
<ContentPresenter />
</Grid>
If you want an example, a quick Google search gave me this answer which contains a code example.
I'd recommend performance testing this too if you have a large set of data.