2011-10-31 16 views
0

以下のようにリストボックスを作成する必要があります。複数列リストボックス

[x] [x] ^
[x] [x] | 
[x] [x] | ----> this is a side scroll and the [x] are pictures 
[x] [x] | 

どうすればいいですか?ここに私のコードがあります。

 <controls:PanoramaItem Header="New one" Name="Pan1" > 
       <ListBox Margin="0,0,-12,0" x:Name="NewTitlesListBox" 
         ItemsSource="{Binding NewPicturesLocal}" 
         SelectionChanged="NewListBoxSelectionChanged"> 

        <ListBox.ItemTemplate> 
         <DataTemplate> 
          <StackPanel Orientation="Horizontal" Margin="0,0,0,20"> 
    <Image Width="110" CacheMode="BitmapCache" Source="{Binding ThumbURL}" 
            Margin="12,0,9,0"/> 

          </StackPanel> 
         </DataTemplate> 
        </ListBox.ItemTemplate> 
       </ListBox> 
      </controls:PanoramaItem> 

この結果:

[x] ^
[x] | 
[x] | ----> this is a side scroll and the [x] are pictures 
[x] | 

私はグリッド(複数の列を追加する)とし、データテンプレートでそれをやろうとしましたが、解決策を見つけることができませんでした。

答えて

2

簡単な解決策はSilverlightツールキットのWrapPanelを使用することです: WrapPanel for WP7。 ListBoxがWrapPanelを使用するようにItemsPanelTemplateを設定する必要があります。私がリンクしているページのコメントにその例があります。 SilverlightのツールキットからWrapPanelを使用して

4

は私の質問

 <controls:PanoramaItem Header="New one" Name="Pan1" > 
       <ListBox Margin="0,0,-12,0" x:Name="NewTitlesListBox" 
         ItemsSource="{Binding NewPicturesLocal}" 
         SelectionChanged="NewListBoxSelectionChanged"> 

       <ListBox.ItemsPanel> 
       <ItemsPanelTemplate> 
        <toolkit:WrapPanel /> 
       </ItemsPanelTemplate> 
       </ListBox.ItemsPanel> 

        <ListBox.ItemTemplate> 
         <DataTemplate> 
          <StackPanel Orientation="Horizontal" Margin="0,0,0,20"> 
    <Image Width="110" CacheMode="BitmapCache" Source="{Binding ThumbURL}" 
            Margin="12,0,9,0"/> 

          </StackPanel> 
         </DataTemplate> 
        </ListBox.ItemTemplate> 
       </ListBox> 
      </controls:PanoramaItem> 
+0

あなたのソリューションを投稿うれしいに対する解決策となります。私はこれが他の誰かのために便利だろうと確信しています。 – Danexxtone

関連する問題