문제

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