Search code examples
silverlightwindows-phone-7textblock

Is it possible to get rendered text from textBlock


I have textBlock defined such that it fills the entire screen of the phone.

The textBlock is initialized with some data which cannot be displayed in the boundary and hence gets clipped.

I want to read the data which actually got rendered on the screen (i.e. whole data - clipped data).

Putting a breakpoint shows me that myNewTextBlock.Text contains the entire data that it was initialized with.

Thanks


Solution

  • You could look at using Measure and MeasureOverride to determine how much of the Text would fit in the available space.

    You'll likely need to test various trimmed versions of the Text but it shouldn't be too tricky.