[UWP] Make sure to update HitTestVisible when IsEnable changes (#1015)
authorRui Marinho <me@ruimarinho.net>
Mon, 26 Jun 2017 18:13:37 +0000 (19:13 +0100)
committerRui Marinho <me@ruimarinho.net>
Mon, 26 Jun 2017 18:19:14 +0000 (19:19 +0100)
Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzila57749.cs [new file with mode: 0644]
Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Xamarin.Forms.Controls.Issues.Shared.projitems
Xamarin.Forms.Platform.WinRT/VisualElementTracker.cs

diff --git a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzila57749.cs b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzila57749.cs
new file mode 100644 (file)
index 0000000..fc16bb5
--- /dev/null
@@ -0,0 +1,49 @@
+using Xamarin.Forms.CustomAttributes;
+using Xamarin.Forms.Internals;
+using System;
+using System.Threading.Tasks;
+
+#if UITEST
+using Xamarin.UITest;
+using NUnit.Framework;
+#endif
+
+namespace Xamarin.Forms.Controls.Issues
+{
+       [Preserve(AllMembers = true)]
+       [Issue(IssueTracker.Bugzilla, 57749, "After enabling a disabled button it is not clickable", PlatformAffected.UWP)]
+       public class Bugzilla57749 : TestContentPage // or TestMasterDetailPage, etc ...
+       {
+               protected override void Init()
+               {
+                       button1.Text = "Click me";
+                       button1.AutomationId = "btnClick";
+                       button1.IsEnabled = false;
+                       button1.Clicked += Button1_Clicked1;
+                       this.Content = button1;
+               }
+               Button button1 = new Button();
+
+               private void Button1_Clicked1(object sender, EventArgs e)
+               {
+                       this.DisplayAlert("Button test", "Button was clicked", "Ok");
+               }
+
+               protected async override void OnAppearing()
+               {
+                       base.OnAppearing();
+                       await Task.Delay(100);
+                       button1.IsEnabled = true;
+               }
+
+#if UITEST
+               [Test]
+               public async void Bugzilla57749Test()
+               {
+                       await Task.Delay(500);
+                       RunningApp.Tap(c => c.Marked("btnClick"));
+                       RunningApp.WaitForElement (q => q.Marked ("Button was clicked"));
+               }
+#endif
+       }
+}
\ No newline at end of file
index ec6439e..a39900b 100644 (file)
     <Compile Include="$(MSBuildThisFileDirectory)AndroidHelpText.cs" />
     <Compile Include="$(MSBuildThisFileDirectory)Bugzilla55365.cs" />
     <Compile Include="$(MSBuildThisFileDirectory)Bugzilla56896.cs" />
+    <Compile Include="$(MSBuildThisFileDirectory)Bugzila57749.cs" />
     <Compile Include="$(MSBuildThisFileDirectory)_Template.cs" />
     <Compile Include="$(MSBuildThisFileDirectory)Issue1028.cs" />
     <Compile Include="$(MSBuildThisFileDirectory)Issue1075.cs" />
index d477028..d4d60cd 100644 (file)
@@ -229,6 +229,10 @@ namespace Xamarin.Forms.Platform.WinRT
                        {
                                UpdateInputTransparent(Element, Container);
                        }
+                       else if (e.PropertyName == VisualElement.IsEnabledProperty.PropertyName)
+                       {
+                               UpdateInputTransparent(Element, Container);
+                       }
                }
 
                protected virtual void UpdateNativeControl()