TailTruncation when the label meets the limit of word wrap in Xamarin Forms - xamarin.forms

In Xamarin.Forms the TailTruncation mode for labels works fine for single lines of text.
We can also force the TailTruncation to happen at the 2nd or 3rd or Nth line, if we know in advance the lenght of the text, using a custom renderer like this one: Depechie MultilineLabel .
But what I really need is a TailTruncation that works even when I don't know in advance how many lines of text will fit in a label.
If the height of my Label changes, and so the number of lines of text that can fit in it, I want the TailTruncation happens at the end of the available space. Not at the line before and neither at the line after.
How can I get TailTruncation happens when the text meets the limit of the available word wrap space inside the Label bounds?
Is there a custom renderer trick that allows to calculate the number of lines that fit inside the bounds and set the TailTruncation line number accordingly (on both iOS and Android)?
Thanks in advance.

Related

Codenameone : How to set MaxLines and MinLines in SpanLabel?

Label in CN1 is limited to being a Single line.
Now that we have to use SpanLabel for anything that can take more than 1 line,
we face one issue.
When we have a strict design that uses consistent height for a list item, we have to give max/min lines allowed for the SpanLabel (At least that's how it works in Android And Flutter).
When I searched for anything that says line in SpanLabel file, I only found that word in one place, that too in a comment.
It did not feel right using fixed height/width property to a SpanLabel as they will vary with fonts and font sizes. The hight should be calculated with respect to the number of lines of the text & font config like font size, line spacing, padding, etc.
What is the right way to achieve consistent height across various SpanLabel despite the varied length of the text they display?
The "right way" would be the layout manager as it would allocate the right amount of space to the span label and everything else. E.g. if you use TableLayout you can allocate the height as percentage.
SpanLabel is technically a TextArea that's encapsulated. It has that distinction between rows/lines which isn't exposed within SpanLabel. But you can manipulate the underlying text area by using getTextComponent().

Line separators in AvalonEdit

I'm using the AvalonEdit control to show data where each line is its own entity, and the lines often wrap. Wrapping allows me to show all the data on the screen at a time, but it can be confusing for users to differentiate between lines and wrapped lines.
Does anyone know if any of the following are possible (ordered by my preference)?
Give the lines a larger seperator size than wrapped lines.
Color the separator space between lines, but not between wrapped lines.
Alternate background colors per line.
Thanks for your help.

force single line in labels of microsoft reporting reports

I have a report which was created using Microsoft Reporting in VS2010. It has labels which must display any text in single line. But it appears that if I don't set the label's height precisely correct, then the text will be displayed in lines bellow if it doesn't fit in a single line. I haven't found a property that enforces single line on labels. What are the ways to enforce single line except setting proper height?
Seems to be no other solution except setting CanGrow = false and guessing the correct label height.

How do I truncate a Flex StyleableTextField after two lines?

In my Flex 4.5 mobile app, I have an actionScript item renderer (that derives from Flex's LabelItemRenderer). I want to fit in exactly 2 lines of text, and then truncate the rest. The width and height of the label are fixed and known statically.
How can I do this? The StyleableTextField.truncateToFit() method only works for one line of text.
I've set wordWrap = true, so the text now flows into the second line - but I need to truncate the text if it doesn't fit in two lines.
I need it to show all the text if there is only one line. (in both cases the label should be vertically middle-aligned in my renderer)
I know how to override layoutContents to do sizing and positioning etc of the StyleableTextField. So I'm looking specifically for ideas to implement custom text truncation with the StyleableTextField).
Any ideas?
Unless you're using something specific to the StyleableTextField try the s:Label. It has a property maxDisplayedLines which you could set to 2 and it will handle the truncation.

Flex wordwrap issue with multiple text instances

I have a scenario where I want to dynamically add words of text to a container so that it forms a paragraph of text which is wrapped neatly according to the size of the parent container. Each text element will have differing formatting, and will have differing user interaction options. For example, imagine the text " has just spoken out about ". Each word will be added to the container one at a time, at run time. The username in this case would be bold, and if clicked on will trigger an event. Same with the news article. The rest of the text is just plain text which, when clicked on, would do nothing.
Now, I'm using Flex 3 so I don't have access to the fancy new text formatting tools. I've implemented a solution where the words are plotted onto a canvas, but this means that the words are wrapped at a particular y position (an arbitrary value I've chosen). When the container is resized, the words still wrap at that position which leaves lots of space.
I thought about adding each text element to an Array Collection and using this as a datasource for a Tile List, but Tile Lists don't support variable column widths (in my limited knowledge) so each word would use the same amount of space which isn't ideal.
Does anyone know how I can plot words onto a container so that I can retain formatting, events and word wrapping at paragraph level, even if the container is resized?
Why aren't you just using a mx:Text component and html text (you can call functions from htmlText), and apply different formatting using html tags.
For information on how to trigger a function from a htmlText field:
http://www.adobepress.com/articles/article.asp?p=1019620

Resources