Pergunta

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

Foi útil?

Solução

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

Outras dicas

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 em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top