开发者

Wrap panel where items in a row share height

i want to add squares to a panel and have them wrapped like the wrap panel.

I then want to make each square horizontally resizable individually, but when it is resized vertically, i need it to affect all the items in it's row.

Basically, I'd want all items in a row to always share the same height, but give the user a method of choosing this height (of course, each row can have its own height, and when squares wrapped to a new row they will need to inherit the new height).

Btw, those "squares"开发者_JAVA百科 are just user controls or data template applied to a listbox items source. Can i use the same binding on a wrap panel, ad maybe i need to choose a different solution?

Thank you


you can try and put each "rectangle" in a Grid with one row and one column, and then use SharedSizeGroup on the RowDefinition. Be sure to also put Grid.IsSharedSizeScope="True" on the container:

    <WrapPanel Grid.IsSharedSizeScope="True">
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition SharedSizeGroup="Group1" />
            </Grid.RowDefinitions>
            <Button Height="40" Content="Hello" />
        </Grid>
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition SharedSizeGroup="Group1" />
            </Grid.RowDefinitions>
            <Button Content="Hello2" />
        </Grid>
    </WrapPanel>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜