I have a Textblock which has an initial amount of text and height of X. As the user uses the program, the lines of text in this textblock increases.
The textblock is hosted in an expander which lives in a scrollview.
I would like to have "More..." text appear when the amount of text in the textblock exceeds the height, and when the More... text is clicked on, the textblock's height expands to display all the text in the textblock. I don't wish for the textblock to scroll, or automatically increase its height (as it affects other expanders living in the scrollview)
Is is possible to do this and how should I approach it?
Subclass TextBlock and add the functionality to render a click-able "More..." text Label (or however you chose to implement it) when the height of the text within the TextBlock exceeds the Height of the TextBlock.
You can measure a string with Graphics.MeasureString()
.
This is from the C# side of things, I don't know anything about WPF, maybe there is an easier way to do it with WPF.