diff options
Diffstat (limited to 'Xamarin.Forms.ControlGallery.WindowsUniversal/FocusEffect.cs')
-rw-r--r-- | Xamarin.Forms.ControlGallery.WindowsUniversal/FocusEffect.cs | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/Xamarin.Forms.ControlGallery.WindowsUniversal/FocusEffect.cs b/Xamarin.Forms.ControlGallery.WindowsUniversal/FocusEffect.cs new file mode 100644 index 00000000..0d4eba05 --- /dev/null +++ b/Xamarin.Forms.ControlGallery.WindowsUniversal/FocusEffect.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Windows.UI; +using Windows.UI.Xaml.Media; +using Xamarin.Forms; +using Xamarin.Forms.ControlGallery.WindowsUniversal; +using Xamarin.Forms.Platform.UWP; + +[assembly: ResolutionGroupName("Xamarin")] +[assembly: ExportEffect(typeof(FocusEffect), "FocusEffect")] +namespace Xamarin.Forms.ControlGallery.WindowsUniversal +{ + public class FocusEffect : PlatformEffect + { + protected override void OnAttached() + { + try + { + (Control as Windows.UI.Xaml.Controls.Control).Background = new SolidColorBrush(Colors.Cyan); + (Control as FormsTextBox).BackgroundFocusBrush = new SolidColorBrush(Colors.White); + } + catch (Exception ex) + { + Debug.WriteLine("Cannot set property on attached control. Error: ", ex.Message); + } + } + + protected override void OnDetached() + { + } + } +}
\ No newline at end of file |