2012-06-15 73 views
0

我想舒展類似的列表框:拉伸水平的ListBox

<Grid Background="#FFC0BBBB"> 
     <Grid.RowDefinitions> 
      <RowDefinition Height="50" /> 
      <RowDefinition Height="*" /> 
     </Grid.RowDefinitions> 
     <Border HorizontalAlignment="Stretch" Grid.Row="0"> 
      <ListBox Name="listBox" > 
       <ListBoxItem > 
        <StackPanel> 
         <TextBlock Text="Toto"></TextBlock> 
         <!--<Image Source ="" Visibility="Collapsed" />--> 
        </StackPanel> 
       </ListBoxItem> 
       <ListBoxItem >listbox item 2</ListBoxItem> 
       <ListBoxItem > 
        <Grid> 
        <TextBlock Text="Tata"></TextBlock> 
        <Image Source ="" /> 
        </Grid> 
       </ListBoxItem> 
       <ListBoxItem > 
        <Grid> 
         <TextBlock Background="Aqua" Text=""></TextBlock> 
         <Image Source ="https://support.twitter.com/images/twitter-bird.png?1339467554" /> 
        </Grid> 
       </ListBoxItem> 
       <ListBoxItem > 
        <Grid> 
         <TextBlock Text="Vava"></TextBlock> 
         <Image Source ="" /> 
        </Grid> 
       </ListBoxItem> 
      <ListBox.ItemsPanel> 
       <ItemsPanelTemplate> 
        <UniformGrid Columns="5" Background="Pink" HorizontalAlignment="Stretch" /> 
       </ItemsPanelTemplate> 
      </ListBox.ItemsPanel>    
      </ListBox> 
     </Border> 
</Grid> 

如果你把剛纔的內容像它完美的第二個項目,但我的「真正的」列表框將被綁定和一些項目我需要把他人的圖像一個TextBlock(我需要圖像+文本塊)。 我認爲我將不得不使用轉換器,但我不知道「放哪」以及他應該返回什麼。

任何想法? 感謝

回答