Hello,
Welcome to our Microsoft Q&A platform!
I'm trying to use the middletruncation attribute in more than one line, but xamarin dosen't allowa me to do that.
We cannot do that. LineBreakMode.MiddleTruncation
truncates the middle of text and replaces it with an ellipsis, this function requires to make sure the 'label' is single line. From the result, we can see that set a value to the MaxLine doesn't work.
Xamarin.Forms is an open-source UI framework. Xamarin.Forms allows developers to build Xamarin.Android, Xamarin.iOS, and Windows applications from a single shared codebase. Xamarin.Android or Xamarin.iOS is only a layer of wrapper for Android/iOS native libraries, no extra operations. In native Android, we use setEllipsize
command to set the line break mode and the middle mode is bases on setting setSingleLine
to true. Here is the related doc, you could refer to: https://developer.android.com/reference/android/widget/TextView#setEllipsize(android.text.TextUtils.TruncateAt)
In native iOS, NSLineBreakMode.byTruncatingMiddle
also uses this mode for single-line layout. Here is the documentation: https://developer.apple.com/documentation/uikit/nslinebreakmode/bytruncatingmiddle
Best Regards,
Jarvan Zhang
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.