Reputation: 70317
Alright, trying this again. All I want is to rotate a text block, nothing tricky. And I don't want to do it using an ItemsControl because it will require using a control for each and every letter, which is way too expensive for my needs.
Upvotes: 0
Views: 354
Reputation: 45096
<TextBlock Width="7" HorizontalAlignment="Left">
S<LineBreak/>
t<LineBreak/>
a<LineBreak/>
c<LineBreak/>
k
</TextBlock>
Upvotes: 0
Reputation: 128070
Despite the controversy if it's a duplicate or not, there may be a way to achieve vertical text on a very low level, involving a GlyphRun. I haven't tested that in detail, but what i know is, you would have to
create a GlyphRun with the IsSideways property set to true, meaning all character will be rotated 90° counter-clockwise,
get a DrawingContext and push (via PushTransform) a 90° clockwise RotateTransform onto it,
draw the GlyphRun to the DrawingContext.
A simple way to get an appropriate DrawingContext would be to override UIElement.OnRender.
Note: GlyphRun's constructor has 13 arguments, but the last 6 may be null :-)
Upvotes: 2