Pregunta

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

¿Fue útil?

Solución

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"
               />     

Otros consejos

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>
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top