How to center text around point using xaml

Posted by Pete d'Oronzio on Stack Overflow See other posts from Stack Overflow or by Pete d'Oronzio
Published on 2010-05-15T02:35:35Z Indexed on 2010/05/15 2:44 UTC
Read the original article Hit count: 336

Filed under:
|

I would like to be able to place the word "hello" centered on a specific point. I need to do this completely in XAML without extra code. Best I can tell, all the text alignment properties/styles in XAML act on text within some bouding canvas or other element.

Since I don't know the length of the text I want to center, I can't center it using my own code.

The reason I need to solve the problem entirely in XAML is that I'm not using WPF to create the XAML, I'm writing it directly to an XML DOM. It will then be loaded into a Silverlight or WPF control for display.

In most graphic languages, including SVG, which is where my code originated, text can be aligned against a "stationary point" without a bounding box.

Any suggestions appreciated

© Stack Overflow or respective owner

Related posts about xaml-only

Related posts about xaml