summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.ControlGallery.WindowsUniversal
diff options
context:
space:
mode:
authorPaul DiPietro <pauldipietro@users.noreply.github.com>2017-05-26 11:09:00 (GMT)
committerRui Marinho <me@ruimarinho.net>2017-05-26 11:09:00 (GMT)
commita9a6a40c67bf52012f46a2809dd98ad0571b48b9 (patch)
tree79b63371d717b43c19fb20ab856d071580ddd89b /Xamarin.Forms.ControlGallery.WindowsUniversal
parentc066aa89715117eeb5d345b3d858986548bf6098 (diff)
downloadxamarin-forms-a9a6a40c67bf52012f46a2809dd98ad0571b48b9.zip
xamarin-forms-a9a6a40c67bf52012f46a2809dd98ad0571b48b9.tar.gz
xamarin-forms-a9a6a40c67bf52012f46a2809dd98ad0571b48b9.tar.bz2
[UWP] Respect TextBox BackgroundFocusBrush Effect (#928)
Diffstat (limited to 'Xamarin.Forms.ControlGallery.WindowsUniversal')
-rw-r--r--Xamarin.Forms.ControlGallery.WindowsUniversal/FocusEffect.cs36
-rw-r--r--Xamarin.Forms.ControlGallery.WindowsUniversal/Xamarin.Forms.ControlGallery.WindowsUniversal.csproj1
2 files changed, 37 insertions, 0 deletions
diff --git a/Xamarin.Forms.ControlGallery.WindowsUniversal/FocusEffect.cs b/Xamarin.Forms.ControlGallery.WindowsUniversal/FocusEffect.cs
new file mode 100644
index 0000000..0d4eba0
--- /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
diff --git a/Xamarin.Forms.ControlGallery.WindowsUniversal/Xamarin.Forms.ControlGallery.WindowsUniversal.csproj b/Xamarin.Forms.ControlGallery.WindowsUniversal/Xamarin.Forms.ControlGallery.WindowsUniversal.csproj
index bfb232e..323d2fd 100644
--- a/Xamarin.Forms.ControlGallery.WindowsUniversal/Xamarin.Forms.ControlGallery.WindowsUniversal.csproj
+++ b/Xamarin.Forms.ControlGallery.WindowsUniversal/Xamarin.Forms.ControlGallery.WindowsUniversal.csproj
@@ -169,6 +169,7 @@
</Compile>
<Compile Include="BrokenNativeControl.cs" />
<Compile Include="CustomRenderers.cs" />
+ <Compile Include="FocusEffect.cs" />
<Compile Include="MainPage.xaml.cs">
<DependentUpon>MainPage.xaml</DependentUpon>
</Compile>