fix selection button behaviour
authorLukasz Stanislawski <lukasz.stanislawski@gmail.com>
Tue, 18 Aug 2020 12:13:01 +0000 (14:13 +0200)
committerLukasz Stanislawski <lukasz.stanislawski@gmail.com>
Tue, 18 Aug 2020 12:13:01 +0000 (14:13 +0200)
Fix selection issues occured after NUI behaviur change:
* Button is not selectable by default. Enable IsSelectable
  proporty to allow applying Selected style.
* When tapped, the selected state changes automatically so using:
  button.IsSelected = !button.IsSelecetd actually reverts selection
  state.

Change-Id: I506b8dfb804e0399d917fcc85c06a1fb93f9eb59

Oobe/Oobe.Wifi/Controls/Wifi/AddNewNetworkPupup.cs
Oobe/Oobe.Wifi/Controls/Wifi/WifiPasswordPopup.cs
Oobe/Oobe.Wifi/Controls/Wifi/WifiView.cs

index 3d88cd1..d842568 100644 (file)
@@ -154,11 +154,11 @@ namespace Oobe.Wifi.Controls.Wifi
             {
                 Size = new Size(32, 32),
                 Position = position,
+                IsSelectable = true,
             };
             button.Clicked += (s, e) =>
             {
                 this.passwordEntry.Revealed = !this.passwordEntry.Revealed;
-                button.IsSelected = !button.IsSelected;
             };
             return button;
         }
index 2722e2f..37a97ed 100644 (file)
@@ -103,6 +103,7 @@ namespace Oobe.Wifi.Controls.Wifi
             {
                 Size = new Size(48, 48),
                 Position = new Position(720, 79),
+                IsSelectable = true,
             };
             revealButton.Clicked += (s, e) => TogglePasswordVisibility();
             this.Add(revealButton);
@@ -164,7 +165,6 @@ namespace Oobe.Wifi.Controls.Wifi
         private void TogglePasswordVisibility()
         {
             passwordEntry.Revealed = !passwordEntry.Revealed;
-            revealButton.IsSelected = !revealButton.IsSelected;
         }
 
         private void UpdateOKButton()
index 06063c4..9478816 100644 (file)
@@ -223,6 +223,7 @@ namespace Oobe.Wifi.Controls.Wifi
                 Size = new Size(72, 32),
                 Position = new Position(369, 39),
             };
+            button.IsSelectable = true;
             button.IsSelected = State.IsTurnedOn;
 
             State.OnTurnedOff += () => button.IsSelected = State.IsTurnedOn;