2014-05-02 50 views
0

我正在創建一個用戶控件,其中有一個畫布,並且在其中有一個Textblock。我需要輸入希伯來語文本,所以我將畫布的FlowDirection設置爲RightToLeft,但是當我將流向更改爲RightToLeft時,文本未顯示。 XAML和快照如下,爲什麼發生?當FlowDirection是RightToLeft時,Windows Phone 8畫布不顯示文字

<Canvas x:Name="canvas" 
       FlowDirection="RightToLeft" 
       > 


      <TextBlock x:Name="textBlock1" 
         Height="{Binding Height}" 
         FontSize="50" 
         TextWrapping="NoWrap" 
         Foreground="{Binding Foreground}" 
         Text="AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"  
         /> 
     </Canvas> 

快照時畫布的FlowDirection是從右至左

enter image description here

快照時帆布的FlowDirection被LeftToRight 的TextBlock

enter image description here

回答

1

設置水平對齊於來氟米特牛逼和文字塊的寬度

   <TextBlock x:Name="textBlock1" 
       Height="46" 
       FontSize="50" 
       HorizontalAlignment="Left" 
       FlowDirection="RightToLeft" 
       TextWrapping="NoWrap" 
       Foreground="White" 
       Text="AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" Width="434" 
       />  
0

這將幫助您:

<Canvas x:Name="canvas" 
      FlowDirection="RightToLeft" 
      > 
      <TextBlock x:Name="textBlock1" 
      Height="46" 
      FontSize="50"       
      TextWrapping="NoWrap" 
      Foreground="White" 
      Text="AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" Width="456" 
      /> 
     </Canvas>