■ ItemsPanelTemplate 엘리먼트 사용하기

----------------------------------------------------------------------------------------------------

<ListBox

    HorizontalAlignment="Center"

    VerticalAlignment="Center">

    <ListBox.Resources>

        <Style TargetType="{x:Type ListBoxItem}">

            <Setter Property="Margin" Value="5" />

            <Setter Property="Padding" Value="5" />

        </Style>

    </ListBox.Resources>

    <ListBox.ItemsPanel>

        <ItemsPanelTemplate>

            <UniformGrid Columns="2" />

        </ItemsPanelTemplate>

    </ListBox.ItemsPanel>

    <ListBoxItem>Whatever Item 1</ListBoxItem>

    <ListBoxItem>Whatever Item 2</ListBoxItem>

    <ListBoxItem>Whatever Item 3</ListBoxItem>

    <ListBoxItem>Whatever Item 4</ListBoxItem>

    <ListBoxItem>Whatever Item 5</ListBoxItem>

    <ListBoxItem>Whatever Item 6</ListBoxItem>

    <ListBoxItem>Whatever Item 7</ListBoxItem>

    <ListBoxItem>Whatever Item 8</ListBoxItem>

    <ListBoxItem>Whatever Item 9</ListBoxItem>

</ListBox>

----------------------------------------------------------------------------------------------------

Posted by 사용자 icodebroker