Skip to content
This repository was archived by the owner on May 1, 2024. It is now read-only.

Commit e94c04a

Browse files
committed
[UWP] Make sure to update HitTestVisible when IsEnable changes (#1015)
1 parent 157f681 commit e94c04a

File tree

3 files changed

+54
-0
lines changed

3 files changed

+54
-0
lines changed
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
using Xamarin.Forms.CustomAttributes;
2+
using Xamarin.Forms.Internals;
3+
using System;
4+
using System.Threading.Tasks;
5+
6+
#if UITEST
7+
using Xamarin.UITest;
8+
using NUnit.Framework;
9+
#endif
10+
11+
namespace Xamarin.Forms.Controls.Issues
12+
{
13+
[Preserve(AllMembers = true)]
14+
[Issue(IssueTracker.Bugzilla, 57749, "After enabling a disabled button it is not clickable", PlatformAffected.UWP)]
15+
public class Bugzilla57749 : TestContentPage // or TestMasterDetailPage, etc ...
16+
{
17+
protected override void Init()
18+
{
19+
button1.Text = "Click me";
20+
button1.AutomationId = "btnClick";
21+
button1.IsEnabled = false;
22+
button1.Clicked += Button1_Clicked1;
23+
this.Content = button1;
24+
}
25+
Button button1 = new Button();
26+
27+
private void Button1_Clicked1(object sender, EventArgs e)
28+
{
29+
this.DisplayAlert("Button test", "Button was clicked", "Ok");
30+
}
31+
32+
protected async override void OnAppearing()
33+
{
34+
base.OnAppearing();
35+
await Task.Delay(100);
36+
button1.IsEnabled = true;
37+
}
38+
39+
#if UITEST
40+
[Test]
41+
public async void Bugzilla57749Test()
42+
{
43+
await Task.Delay(500);
44+
RunningApp.Tap(c => c.Marked("btnClick"));
45+
RunningApp.WaitForElement (q => q.Marked ("Button was clicked"));
46+
}
47+
#endif
48+
}
49+
}

Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Xamarin.Forms.Controls.Issues.Shared.projitems

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,7 @@
284284
<Compile Include="$(MSBuildThisFileDirectory)AndroidHelpText.cs" />
285285
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla55365.cs" />
286286
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla56896.cs" />
287+
<Compile Include="$(MSBuildThisFileDirectory)Bugzila57749.cs" />
287288
<Compile Include="$(MSBuildThisFileDirectory)_Template.cs" />
288289
<Compile Include="$(MSBuildThisFileDirectory)Issue1028.cs" />
289290
<Compile Include="$(MSBuildThisFileDirectory)Issue1075.cs" />

Xamarin.Forms.Platform.WinRT/VisualElementTracker.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,10 @@ protected virtual void OnPropertyChanged(object sender, PropertyChangedEventArgs
229229
{
230230
UpdateInputTransparent(Element, Container);
231231
}
232+
else if (e.PropertyName == VisualElement.IsEnabledProperty.PropertyName)
233+
{
234+
UpdateInputTransparent(Element, Container);
235+
}
232236
}
233237

234238
protected virtual void UpdateNativeControl()

0 commit comments

Comments
 (0)