2013-02-01 3 views
3

첫 줄이있을 때 다음 줄로 이동하려면 어떻게합니까?ListBox는 Windows Phone 8에서 자동으로 다음 줄을 입력합니다.

<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0"> 
    <TextBlock Text="Picture" Style="{StaticResource PhoneTextNormalStyle}"/> 
    <ListBox x:Name="picList" ScrollViewer.HorizontalScrollBarVisibility="Auto"> 
     <ListBox.ItemsPanel> 
      <ItemsPanelTemplate> 
       <StackPanel Orientation="Horizontal"/> 
      </ItemsPanelTemplate> 
     </ListBox.ItemsPanel> 
     <ListBox.ItemTemplate> 
      <DataTemplate> 
       <StackPanel> 
        <Image Source="{Binding Picture}" Height="80" Width="80"/> 
       </StackPanel> 
      </DataTemplate> 
     </ListBox.ItemTemplate> 
    </ListBox> 
</Grid> 

답변

6

대신 StackPanelWrapPanel를 사용

다음은 내 현재 코드입니다. Windows Phone 8은 WrapPanel 컨트롤을 제공하지 않으므로 Windows Phone Toolkit을 사용해야합니다.

<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0"> 
    <TextBlock Text="Picture" Style="{StaticResource PhoneTextNormalStyle}"/> 
    <ListBox x:Name="picList" ScrollViewer.HorizontalScrollBarVisibility="Auto"> 
     <ListBox.ItemsPanel> 
      <ItemsPanelTemplate> 
       <WrapPanel Orientation="Horizontal" 
          Width="300" 
          HorizontalAlignment="Left" 
          /> 
      </ItemsPanelTemplate> 
     </ListBox.ItemsPanel> 
     <ListBox.ItemTemplate> 
      <DataTemplate> 
       <StackPanel> 
        <Image Source="{Binding Picture}" Height="80" Width="80"/> 
       </StackPanel> 
      </DataTemplate> 
     </ListBox.ItemTemplate> 
    </ListBox> 
</Grid> 
+0

WrapPanel은 존재하지 않습니다. – Alvin

+0

죄송합니다. 귀하의 질문에 Windows 전화 태그가 표시되지 않았습니다. WrapPanel은 Windows Phone Toolkit (https://phone.codeplex.com/)에서 구할 수 있습니다. –

관련 문제