I am creating a User control which has a canvas and within which I have a Textblock. I need to enter hebrew text so I set the FlowDirection of canvas to RightToLeft but when I change flow direction to RightToLeft The text is not getting displayed. The XAML and snapshot is as below, why is it happening?

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


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

Snapshot when Flowdirection of canvas is RightToLeft

enter image description here

Snapshot when Flowdirection of canvas is LeftToRight

enter image description here

有帮助吗?

解决方案

Set Horizontal Alignment of TextBlock to Left and width of the textblock

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

其他提示

This would help you:

<Canvas x:Name="canvas" 
           FlowDirection="RightToLeft"
           >
           <TextBlock x:Name="textBlock1"
           Height="46" 
           FontSize="50"                           
           TextWrapping="NoWrap" 
           Foreground="White"
           Text="AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"  Width="456"
           />
        </Canvas>
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top