Forum Xamarin.Forms


The Xamarin Forums have officially moved to the new Microsoft Q&A experience. Microsoft Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

To create new threads and ask questions head over to Microsoft Q&A for .NET and get involved today.

Is there a way to tell if a label will truncate text?

I have an iOS implementation I am trying to port to forms.
In the iOS version I show full names but if the name will be longer than the field width I use first initial and last name, if it still doesnt fit then it gets truncated with ellipses. Basically in my iOS version I measure the text using nsstring.GetSizeUsingAttributes.

Is there a way I can do this in Forms?

Maybe I can make a custom binding converter or something, just not sure if there is a similar way to measure text.



Best Answer


  • JasonMichasJasonMichas USMember ✭✭

    @AdamP - Yeah, as usual, almost immediately after I posted my question I thought of implementing a dependency service of the implementation I already had for the native iOS version. So, I will have to do one per platform, but thats OK.

    Thanks for the answer!

  • KymPhillpotts.3866KymPhillpotts.3866 AUXamarin Team, University, XamUProfessors Xamurai

    Depending on how specific you need to be with your text measurements you might want to have a look at Charles Petzolds chapter on sizing. (Chapter 5 -

    He does some pretty great stuff with approximating text sizes in that chapter.

  • JasonMichasJasonMichas USMember ✭✭

    @Kym_Phillpotts Cool, thanks I will check that out.

Sign In or Register to comment.