diff options
author | Paul DiPietro <pauldipietro@users.noreply.github.com> | 2017-05-26 06:09:00 -0500 |
---|---|---|
committer | Rui Marinho <me@ruimarinho.net> | 2017-05-26 12:09:00 +0100 |
commit | a9a6a40c67bf52012f46a2809dd98ad0571b48b9 (patch) | |
tree | 79b63371d717b43c19fb20ab856d071580ddd89b /Xamarin.Forms.ControlGallery.WindowsUniversal | |
parent | c066aa89715117eeb5d345b3d858986548bf6098 (diff) | |
download | xamarin-forms-a9a6a40c67bf52012f46a2809dd98ad0571b48b9.tar.gz xamarin-forms-a9a6a40c67bf52012f46a2809dd98ad0571b48b9.tar.bz2 xamarin-forms-a9a6a40c67bf52012f46a2809dd98ad0571b48b9.zip |
[UWP] Respect TextBox BackgroundFocusBrush Effect (#928)
Diffstat (limited to 'Xamarin.Forms.ControlGallery.WindowsUniversal')
-rw-r--r-- | Xamarin.Forms.ControlGallery.WindowsUniversal/FocusEffect.cs | 36 | ||||
-rw-r--r-- | Xamarin.Forms.ControlGallery.WindowsUniversal/Xamarin.Forms.ControlGallery.WindowsUniversal.csproj | 1 |
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 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 diff --git a/Xamarin.Forms.ControlGallery.WindowsUniversal/Xamarin.Forms.ControlGallery.WindowsUniversal.csproj b/Xamarin.Forms.ControlGallery.WindowsUniversal/Xamarin.Forms.ControlGallery.WindowsUniversal.csproj index bfb232e8..323d2fd8 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> |