123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- using System.ComponentModel;
- using InABox.Mobile;
- using InABox.Mobile.iOS;
- using UIKit;
- using Xamarin.Forms;
- using Xamarin.Forms.Platform.iOS;
- [assembly: ExportRenderer(typeof(MobileEditor), typeof(MobileEditorRenderer))]
- namespace InABox.Mobile.iOS
- {
- class MobileEditorRenderer : EditorRenderer
- {
- public MobileEditorRenderer()
- {
- UIKeyboard.Notifications.ObserveWillShow((sender, args) =>
- {
- if (Element != null)
- {
- Element.Margin = new Thickness(0, 0, 0, args.FrameEnd.Height); //push the entry up to keyboard height when keyboard is activated
- }
- });
- UIKeyboard.Notifications.ObserveWillHide((sender, args) =>
- {
- if (Element != null)
- {
- Element.Margin = new Thickness(0); //set the margins to zero when keyboard is dismissed
- }
- });
- }
- protected override void OnElementChanged(ElementChangedEventArgs<Editor> e)
- {
- base.OnElementChanged(e);
- if (Control != null)
- {
- Control.Layer.CornerRadius = 5;
- Control.TextColor = UIColor.Black;
- }
- }
-
- // protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e)
- // {
- // base.OnElementPropertyChanged(sender, e);
- // if (Control != null)
- // {
- // // just change this statement to the one that works.
- // Control.SelectedTextRange = Control.GetTextRange(fromPosition: Control.BeginningOfDocument, toPosition: Control.BeginningOfDocument);
- // }
- // }
- }
- }
|