views:

43

answers:

1

I have a textblock that contains some text but the text is always going to vary length and I need to render a bitmap out of this textblock. The problem is the textblock doesn't have a height, width, actual height, actual width, or desired size since I set the height and width to Double.NaN so the textblock would auto size. This causes me a problem because when I go to measure and arrange the text block I have no values. So is there a way for me to get a height and width measurement based on the text inside the textblock?

A: 

Does this answer your question?

http://blogs.microsoft.co.il/blogs/tamir/archive/2007/03/12/Text-length-measurement_3F00_-It_2700_s-really-easy-with-WPF.aspx

letstango
Nope because TextBlock doesn't have the same method as textbox does in that example.
Nathan