Discount selfridges mulberry purse Outlet multi line label custom renderer gotcha

mulberry handbags uk black friday multi line label custom renderer gotcha

On a project I working on, we needed a label that would show an ellipsis at the end. ( the 3 indicating there is more text but not enough space on the screen to fit it all )

Having this on a label control in Xamarin forms is easy, you just add the property

this will force the ellipsis to appear if needed.

But on a specific page we wanted to show more text to the end user and even than add an ellipsis if needed. So in other words we would love to be able to tell the label control how many lines it should at least try to display.

To get this working in Xamarin forms you need to add a custom renderer. Because the Xamarin forms label control doesn have any property available for us to manipulate to accomplish this.

This is not difficult at all to do,
Discount selfridges mulberry purse Outlet multi line label custom renderer gotcha
but there is a small gotcha with Android when you want to pull this off!

But let start with what you need to do to get this working.

It inherits from Label and we only need to add 1 dependency property called Lines, defined as an int. It looks like this:

It took me a while to figure this out ( I no Android expert ). But after taking a look in the Xamarin forms source code ( glad it open source ) I noticed they will always force a SetSingleLine(true) when setting the TailTruncation LineBreakMode .
Discount selfridges mulberry purse Outlet multi line label custom renderer gotcha