Protected override void OnElementChanged(ElementChangedEventArgs e) Public SelectableLabelRenderer(Context context) : base(context) Public class SelectableLabelRenderer : ViewRenderer Protected override void OnSelectionChanged(int selStart, int selEnd) Public MyTextView(Context context) : base(context) Public static readonly BindableProperty FontSizeProperty = BindableProperty.Create(nameof(FontSize), typeof(double), typeof(SelectableLabel), -1.0) Public static readonly BindableProperty FontAttributesProperty = BindableProperty.Create(nameof(FontAttributes), typeof(FontAttributes), typeof(SelectableLabel), FontAttributes.None) Public static readonly BindableProperty TextColorProperty = BindableProperty.Create(nameof(TextColor), typeof(Color), typeof(SelectableLabel), Color.Black) Public static readonly BindableProperty TextProperty = BindableProperty.Create(nameof(Text), typeof(string), typeof(SelectableLabel), default(string)) SelectableLabel public class SelectableLabel : View This is an excellent article for customizing Selectable Label in Xamarin.forms, we can implement it using ViewRenderer: UITextView in iOS and TextView in Android, and i add some code for detecting selection on iOS and Android.
0 Comments
Leave a Reply. |