티스토리 뷰

찾은 곳


<ListBox DockPanel.Dock="Top" ScrollViewer.HorizontalScrollBarVisibility="Disabled">

  <ListBox.ItemsPanel>

    <ItemsPanelTemplate>

      <WrapPanel IsItemsHost="True"/>

    </ItemsPanelTemplate>

  </ListBox.ItemsPanel>

  <ListBox.ItemContainerStyle>

    <Style TargetType="ListBoxItem">

      <Setter Property="Template">

        <Setter.Value>

          <ControlTemplate TargetType="ListBoxItem">

            <Border BorderThickness="1" BorderBrush="SlateGray" Margin="2">

              <ContentPresenter ContentSource="Content"/>

            </Border>

          </ControlTemplate>

        </Setter.Value>

      </Setter>

    </Style>

  </ListBox.ItemContainerStyle>

</ListBox>


ListBox는 개별 아이템을 ListBoxItem으로 감싸는데, 그 ListBoxItem의 Template을 스타일로 건드려서 감싸는 부분을 수정할 수 있다.


ItemsControl로도 가능할진 모르겠다. WrapPanel을 감싸려했는데 Template이 없다고 안 되고..

댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2024/04   »
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30
글 보관함