2012-03-08 3 views
0

2 개의 텍스트 블록이있는 스택 패널이 있습니다. 문제는 내 textblocks가 텍스트를 래핑하지 않는다는 것입니다. 텍스트 블록 줄 바꿈이 하나 뿐인 경우에도 이상한 점은 작동하지 않습니다.스택 패널의 텍스트 줄 바꾸기

 <StackPanel Orientation="Horizontal" VerticalAlignment="Top" Grid.Row="1" Grid.ColumnSpan="2" Margin="0"> 
      <!--<ContentControl Width="800">--> 
       <TextBlock x:Name="textBlock" TextWrapping="Wrap" Text="{Binding Path=StaticTextLibrary.ApplicationSubtitle, Source={StaticResource ResourcesManager}}" 
         FontSize="14" HorizontalAlignment="Left" Foreground="{StaticResource text}" Opacity="0" RenderTransformOrigin="0.5,0.5" 
         VerticalAlignment="Bottom" Padding="5" Height="30"> 
        <TextBlock.RenderTransform> 
         <CompositeTransform TranslateX="30"/> 
        </TextBlock.RenderTransform> 
       </TextBlock> 
      <!--</ContentControl>--> 
      <TextBlock x:Name="subTitlePostfix" TextWrapping="Wrap" Text="by Credit Suisse©" Margin="6,0,0,0" Opacity="0" RenderTransformOrigin="0.5,0.5" VerticalAlignment="Top" HorizontalAlignment="Left" Foreground="{StaticResource text}" Padding="0,4,0,0" > 
        <TextBlock.RenderTransform> 
         <CompositeTransform TranslateX="30"/> 
        </TextBlock.RenderTransform> 
      </TextBlock> 
     </StackPanel> 

어디에서 실수 했습니까?

+0

TextBlock의 텍스트가 스택 패널 외부로 나가서 잘립니다. (예 : 텍스트의 일부만 보시겠습니까?) –

+0

예, 맞습니다. @Baboon – user278618

답변

1

코드에 복사 한 다음 줄 바꿈 될 때까지 펀치했습니다.
다음은 몇 가지 노트와 해결책입니다.

첫 번째 TextBlock은 높이를 지정하지만 30 번째 줄은 두 번째 줄로는 충분하지 않습니다. ==> 두 번째 줄을 만들 수 없기 때문에 줄 바꿈을 할 수 없습니다. Height="30"을 삭제하십시오.

StackPanel 대신 WrapPanel을 사용 하시겠습니까? 특별한 것을 염두에 두지 않는 한.

CompositeTransform TranslateX="30" 대신 TranslateTransform x="30"을 사용했는데 문제가되지 않습니다.

HTH,

bab.

관련 문제