How to get the width of the whole text of the widget in WPF?
- by macias
Remarks
Before I ask, let me focus on words:
the length of "i" is 1
the length of "w" is 1
the render width of "w" is greater than "i" (except for monospace font) -- I am interested in this and from now on, I would simply write "width"
The problem (small picture)
Let's say I have incredible long text set for TextBlock widget which width is 100. And the text does not fit (the text is clipped -- i.e. only small portion of text is visible).
The question is -- what is the width of the entire text (visible + not visible parts)?
The background (big picture)
I have a window width DataGrid (WPF standard) as main widget which contains text. I try to resize window and DataGrid in such way, that all texts will be visible without need of resizing and/or scrolling.
I focus on width. The size of the window vs. size of the screen is not an issue, the text is so short that it would fit even on netbook screen.