Truncate label text from the left - xamarin.forms

I have a Label that displays the full name and path of the file that the app is currently processing.
The way Labels perform text truncation, the "C:\..." part of the path is always shown, while the actual file name is only shown if it fits. I would rather truncate on the left side, so that the file name is always shown, while the "C:\..." part is only shown if it fits.
Is this possible in Xamarin Forms?

If you read the docs these are the options for truncation
HeadTruncation – truncates the head of the text, showing the end.
CharacterWrap – wraps text onto a new line at a character boundary.
MiddleTruncation – displays the beginning and end of the text, with the middle replace by an ellipsis.
NoWrap – does not wrap text, displaying only as much text as can fit on one line.
TailTruncation – shows the beginning of the text, truncating the end.
WordWrap – wraps text at the word boundary.
HeadTruncation appears to be what you're looking for

Related

ADOBE ACROBAT PRO MULTI LINE ALIGNMENT

I'm working on a form which has 2 lines in a particular section. The first line has 2 words out of which the first word is dynamic and the second line has 2 words as well(but are hardcoded words). Now the concern is that the second line needs to be aligned to the left based on the dynamic first word on the top line but the alignment is not working as expected. It works well when the second line is set to align to right so that if the dynamic word becomes long the second line still stays in place and looks good. But is there a way to align the second line to left based on the dynamic first word on top line so that both the lines are aligned left? The business wants it to be left aligned both both the lines.
The dynamic word is set to align right currently because if we make it left, then there is a gap between the dynamic word and the second word(hardcoded) on the first line.
Any input will be appreciated
We are using adobe acrobat pro

Tooltip overlay over container component

I have a component with tooltip icon when there is an error.
The problem starts when the text for the tooltip includes a one large word (without spaces).
In such case the text inside the tooltip box exceed the borders.
Please see this sandbox:
https://codesandbox.io/s/fragrant-morning-267l5
By default, word breaks on a new line if it is long enough that there is no space left for it to be on the same line. Since you are typing one long word it can't find a new word to break on so it goes over the box.
What you can do is instead breaking on a word you can break on a letter
word-wrap: break-word;
Add that CSS to text. When it runs out of space for new letter it will go to next line.
Read more about it here
Hope this helps :)

Arabic/English text being shuffled

I have been stocked in a strange problem
I have a text box and i am trying to read the text. But when the text box contains both arabic and english text it seems that the text is shuffled . This is how i read my text from text box:
string temp = input.Text;
This is text that i am inserting in text box:
باهم and englishمتن فارسی
And this is the text that i get from textbox:
متن فارسی and english باهم
Add RLE char at the beginning of the text.
const char RightToLeftEmbedding = (char)0x202B;
Arabic is a right to left language. English is left to right. So that actually is correct- the arabic on screen will be in opposite order (string position 0 will be on the far right).
It's probably not a problem with ASP.NET, but with the HTML that it outputs.
Inspect the HTML elements in the browser and check the "direction" property in the computed style. If the main language of your input box is Arabic or Persian, it should be "rtl", and if it's English, then it should be "ltr". If it's the other way, you need to adjust it by using the appropriate dir attribute on the HTML elements.
This only adjusts it for the user interface. The text is probably saved into your database not with the correct direction, but that may be fine, because the database is internal and usually not seen by users.

Respect space in code but ignore with CSS?

With CSS can I make a browser ignore the character but respect normal white space?
So this:
Some text More text
Is displayed like this:
Some text More text
Not:
Some text More text
UPDATE There is actually more white space in my code. I need the default behavior where extra white space doesn't get rendered on the page so I dont think I can use white-space: pre or pre-wrap
So this shouldn't be excessively indent before the initial word.
Some text More text
I don't think there's a pure CSS way of doing that, since is an actual character that is different from the whitespace created by the spacebar in a text editor (what gets ignored by HTML renderers). However, depending on how those are appearing, you may be able to use a script that searches for and removes that character wherever it sees it.

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