Note that there are some explanatory texts on larger screens.

plurals
  1. PORotated textblock doesn't have the correct length
    primarykey
    data
    text
    <p>I am trying to fill a Grid in a WPF application dynamically.</p> <p>I'm creating a row and then some columns. in each column I am adding a textblock, like this:</p> <pre><code>GrdMainGrid.RowDefinitions.Add(new RowDefinition(Height = new GridLength(150, GridUnitType.Pixel); GrdMainGrid.RowDefinitions.Add(new RowDefinition(Height = new GridLength(1, GridUnitType.Star); for(var i=0; i&lt;4; i++) { GrdMainGrid.ColumnDefinitions.Add(new ColumnDefinition {With = new GridLength(25, GridUnitType.Pixel)}); } var header = new TextBlock {Text = "Header1", RenderTransform = new RotateTransform(-90), Width = 150, Margin = new Thickness(0), VerticalAlignment = VerticalAlignment.Bottom, HorizontalAlignment = HorizontalAlignment.Left}; . . . Grid.SetColumn(header, 0); Grid.SetRow(header, 0); . . . GrdMainGrid.Children.Add(header); </code></pre> <p>The textblock is rotated -90 degree. While the size of the column is set to 25 pixel i doesn't show all text, when I increase the size of the column the text in textblock is also increased. see pic <img src="https://i.stack.imgur.com/lTuPO.jpg" alt="enter image description here"></p> <p><img src="https://i.stack.imgur.com/kylTd.jpg" alt="enter image description here"></p> <p>I could understand this if the textblock wasn't rotated and it didn't fit in the column. But what has it to do with the size of the column when it's rotated. And is it possible somehow to decrease the width of the column without decreasing size of text ? Tnx in advance.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload