using System; using SampleApp.CustomRenderers; using Xamarin.Forms; using SampleApp.iOS; using Xamarin.Forms.Platform.iOS; [assembly: ExportRenderer(typeof(FocusEvents), typeof(iOSFocusEvents))] namespace SampleApp.iOS { public class iOSFocusEvents : ImageRenderer { protected override void OnElementChanged(ElementChangedEventArgs e) { base.OnElementChanged(e); if (Control != null) { SetNativeControl(new CustomButton()); } } } public class CustomButton : FormsUIImageView { public CustomButton() : base() { Console.WriteLine("Custom button created"); } public override void AccessibilityElementDidBecomeFocused() { base.AccessibilityElementDidBecomeFocused(); Console.WriteLine("Ding Dong"); } public override void AccessibilityElementDidLoseFocus() { base.AccessibilityElementDidLoseFocus(); Console.WriteLine("Campanello ha perso il focus"); } } }