2011-12-29 12 views
0

スタックパネルにあるテキストブロックにコンテンツをラップする必要があります。水平view..IでWrapPanelの使用

  match is between India and 
      pakistan 

は単一でそれを必要とする次のXAMLコードは、リストボックスの幅が小さい垂直視で例えば

 <ListBox.ItemTemplate> 

      <DataTemplate> 

        <StackPanel Width="300"> 

        <Image Height="160" HorizontalAlignment="Left" Margin="0,0,-400,0" VerticalAlignment="Top" Width="175" Source="{Binding thumb}"/> 
        <!--ContentControl Width="150" Height="110" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="0,0,-400,0" Content="{Binding Image}"/>--> 
        <TextBlock TextWrapping="Wrap" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="190,-167,-200,0" Text="{Binding title}"/> 
        <TextBlock TextWrapping="Wrap" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="190,-135,-200,0" Text="{Binding page}"/> 


        <TextBlock FontSize="15" TextWrapping="Wrap" Height="Auto" Margin="190,-95,-200,0" Text="{Binding Name}" /> 

        </StackPanel> 

      </DataTemplate> 
     </ListBox.ItemTemplate  


    When i specify the width of the text block the text wrap works in the vertical and horizontal orientation. 

      I want the text to wrap in the vertical view only and in the horizontal view the text should not wrap without mention the textblock width. 

そうテキストがあるべきですライン

はインドとパキスタンの間にあります。

ありがとうございました!

>

答えて

2
<DataTemplate> 
     <Grid> 
      <Grid.ColumnDefinitions> 
       <ColumnDefinition Width="Auto" /> 
       <ColumnDefinition Width="*" /> 
      </Grid.ColumnDefinitions> 
      <Image Grid.Column="0" ... /> 
      <StackPanel Grid.Column="1"> 
       <TextBlock TextWrapping="NoWrap" ... /> 
       <TextBlock TextWrapping="NoWrap" ... /> 
       <TextBlock TextWrapping="Wrap" ... /> 
      </StackPanel> 
     </Grid> 
</DataTemplate> 
+0

今その作品罰金..あなたよりこんにちはお返事のために! –

関連する問題