Why is my text clipped?

When I try to add a text block to a border element, I only see part of the text. I rotate the text by adding it to the border and this causes a problem. Increasing the width of the border eliminates this problem. But my border should be only 20 units.

alt text http://img257.imageshack.us/img257/1702/textcrop.jpg

What am I missing here?

        <Border
          Name="BranchBorder"
          CornerRadius="0"
          HorizontalAlignment="Left"
          Width="20">
          <TextBlock 
            Name="Branch" 
            FontSize="14"
            FontWeight="Bold"
            VerticalAlignment="Center">
           <TextBlock.RenderTransform>
             <RotateTransform 
               Angle="-90"/>
           </TextBlock.RenderTransform>
            Branch
          </TextBlock>
        </Border>
+3
source share
2 answers

Try using LayoutTransform

    <Border
      Name="BranchBorder"
      CornerRadius="0"
      HorizontalAlignment="Left"
      Width="20">
      <TextBlock
         Name="Branch"
         FontSize="14"
        FontWeight="Bold"
        VerticalAlignment="Center">
       <TextBlock.LayoutTransform>
         <RotateTransform
            Angle="-90"/>
       </TextBlock.LayoutTransform>
        Branch
      </TextBlock>
    </Border>

There are tons of blog posts describing the difference between RenderTransform and LayoutTransform , and here's a cool visual demo from Charles Petzold RenderTransformVersusLayoutTransform.xaml

+7

, <border> , . , 20 , -90 .

, , .

0

Source: https://habr.com/ru/post/1705588/


All Articles