Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using EffectsExemplo.iOS.Effects;
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Text;
- using UIKit;
- using Xamarin.Forms;
- using Xamarin.Forms.Platform.iOS;
- [assembly: ResolutionGroupName("Bertuzzi")]
- [assembly: ExportEffect(typeof(FocusEffect), "FocusEffect")]
- namespace EffectsExemplo.iOS.Effects
- {
- public class FocusEffect : PlatformEffect
- {
- UIColor backgroundColor;
- protected override void OnAttached()
- {
- try
- {
- Control.BackgroundColor = backgroundColor = UIColor.FromRGB(204, 153, 255);
- }
- catch (Exception ex)
- {
- Console.WriteLine("Error: ", ex.Message);
- }
- }
- protected override void OnDetached()
- {
- }
- protected override void OnElementPropertyChanged(PropertyChangedEventArgs args)
- {
- base.OnElementPropertyChanged(args);
- try
- {
- if (args.PropertyName == "IsFocused")
- {
- if (Control.BackgroundColor == backgroundColor)
- {
- Control.BackgroundColor = UIColor.White;
- }
- else
- {
- Control.BackgroundColor = backgroundColor;
- }
- }
- }
- catch (Exception ex)
- {
- Console.WriteLine("Error: ", ex.Message);
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment