1

I'm trying to align my WrapPanel to have the same spacing size, although I can't figure out how. Here's an example of what I want,

enter image description here

XAML Code:

        <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>

Any help is greatly apperciated.

1 Answer 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>
1
  • Wow, I should of thought of that, I did that in HTML/CSS before. Thanks a lot chamila_c! It worked perfectly.
    – Jason
    Commented Dec 12, 2012 at 19:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.