1

我正在尝试对齐我WrapPanel的间距大小,尽管我不知道如何。这是我想要的一个例子,

在此处输入图像描述

XAML 代码:

        <ListBox Grid.Row="1" ItemsSource="{Binding HolidayGenerator}" ScrollViewer.HorizontalScrollBarVisibility="Disabled">
        <ListBox.ItemsPanel>
            <ItemsPanelTemplate>
                <toolkit:WrapPanel Orientation="Horizontal"/>
            </ItemsPanelTemplate>
        </ListBox.ItemsPanel>
        <ListBox.ItemTemplate>
            <DataTemplate>
                <CheckBox Content="{Binding Name}" IsChecked="{Binding IsSelected, Mode=TwoWay}" HorizontalAlignment="Right" />
            </DataTemplate>
        </ListBox.ItemTemplate>
    </ListBox>

非常感谢任何帮助。

4

1 回答 1

3

I can't be sure that this will work, but I'm thinking that you may be able to coerce the vertical alignment of each column by setting the ItemWidth property on the WrapPanel (using a value that is appropriate based on the column width that you want it to render with):

<ItemsPanelTemplate>
    <toolkit:WrapPanel Orientation="Horizontal" ItemWidth="25" />
</ItemsPanelTemplate>
于 2012-12-12T19:39:17.380 回答