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.
Asked
Active
Viewed 311 times
0
-
1P.S. And please don't just blindly delete it because I've "got too much reputation" or some other nonesense like that. Seriously, there is no need to act like that. – Jonathan Allen Feb 06 '12 at 20:52
-
possible duplicate of [Vertical Text in Wpf TextBlock](http://stackoverflow.com/questions/349875/vertical-text-in-wpf-textblock) – H.B. Feb 06 '12 at 20:55
-
Bounties *do* get attention to a question even if it has an accepted answer. – H.B. Feb 06 '12 at 20:55
-
1Again, that one uses an ItemsControl. So unless you've got a specific one other than the accepted answer it doesn't help. – Jonathan Allen Feb 06 '12 at 20:56
-
This is a duplicate with a little localization spin on it, the answers on the other question **do not matter**. Just because you don't like the answes does not mean you can create duplicates. – H.B. Feb 06 '12 at 20:58
-
Tags *do not* belong into the tile. – H.B. Feb 06 '12 at 20:59
-
1Seriously, why are you interfering? You aren't helping me or the community at large by preventing people from asking questions. I shouldn't have to fight to defend such a simple question. – Jonathan Allen Feb 06 '12 at 21:00
-
I am helping the community by keeping it clear of clutter. – H.B. Feb 06 '12 at 21:01
2 Answers
2
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 :-)

Clemens
- 123,504
- 12
- 155
- 268
-
Interesting. This is definitely something I would like to look into further. – Jonathan Allen Feb 07 '12 at 03:54
-
Great. I'd love to hear whether you were successful with this approach. – Clemens Feb 07 '12 at 09:42
0
<TextBlock Width="7" HorizontalAlignment="Left">
S<LineBreak/>
t<LineBreak/>
a<LineBreak/>
c<LineBreak/>
k
</TextBlock>

paparazzo
- 44,497
- 23
- 105
- 176