amaro tati

amaro tati

  • NA
  • 27
  • 4.8k

How can I break the text in a Picker’s selection dialog wrap

Feb 27 2019 2:04 AM
I'm working with Xamarin.Forms, and the problem that I'm running into is wrapping text in the selection dialog
 
When the text very long exceeds the limit and does not show the rest of the text, I want to intend to break line when the text is long
  1. public class CustomPickerRenderer : PickerRenderer  
  2. {  
  3.     public CustomPickerRenderer(Context context) : base(context) { }  
  4.     CustomPicker element;  
  5.     protected override void OnElementChanged(ElementChangedEventArgs e)  
  6.     {  
  7.         base.OnElementChanged(e);  
  8.         element = (CustomPicker)this.Element;  
  9.         if (Control != null && this.Element != null) ;  
  10.         var et = this.Control as EditText;  
  11.         Control.SetMaxLines(3);  
  12.         Control.Ellipsize = TextUtils.TruncateAt.End;  
  13.         Control.SetTextSize(Android.Util.ComplexUnitType.Sp, 15f);  
  14.         Control.SetSingleLine(false);  
  15.         // et.SetSingleLine(true);  
  16.     }  
  17. }  
This is my code

Answers (2)