瀏覽代碼

Moved EventArgs<T> to sep file.
Toggled -> Toggle.

Tig 1 年之前
父節點
當前提交
b55ee57371

+ 0 - 17
Terminal.Gui/View/CancelEventArgs.cs

@@ -33,20 +33,3 @@ public class CancelEventArgs<T> : CancelEventArgs where T : notnull
     /// <summary>The value the property will be set to if the event is not cancelled.</summary>
     public T NewValue { get; set; }
 }
-
-/// <summary>
-///     <see cref="EventArgs"/> for events that convey changes to a property of type <typeparamref name="T"/>.
-/// </summary>
-/// <typeparam name="T">The type of the value that was part of the change being canceled.</typeparam>
-public class EventArgs<T> : EventArgs where T : notnull
-{
-    /// <summary>Initializes a new instance of the <see cref="EventArgs{T}"/> class.</summary>
-    /// <param name="currentValue">The current value of the property.</param>
-    /// <typeparam name="T">The type of the value.</typeparam>
-    public EventArgs (ref readonly T currentValue) { CurrentValue = currentValue; }
-
-    /// <summary>The current value of the property.</summary>
-    public T CurrentValue { get; }
-}
-
-#pragma warning disable CS1711

+ 9 - 9
Terminal.Gui/Views/CheckBox.cs

@@ -25,8 +25,8 @@ public class CheckBox : View
         CanFocus = true;
 
         // Things this view knows how to do
-        AddCommand (Command.Accept, OnToggled);
-        AddCommand (Command.HotKey, OnToggled);
+        AddCommand (Command.Accept, OnToggle);
+        AddCommand (Command.HotKey, OnToggle);
 
         // Default keybindings for this view
         KeyBindings.Add (Key.Space, Command.Accept);
@@ -39,7 +39,7 @@ public class CheckBox : View
 
     private void CheckBox_MouseClick (object? sender, MouseEventEventArgs e)
     {
-        e.Handled = OnToggled () == true;
+        e.Handled = OnToggle () == true;
     }
 
     private void Checkbox_TitleChanged (object? sender, EventArgs<string> e)
@@ -109,11 +109,11 @@ public class CheckBox : View
         }
     }
 
-    /// <summary>Called when the <see cref="Checked"/> property changes. Invokes the <see cref="Toggled"/> event.</summary>
+    /// <summary>Called when the <see cref="Checked"/> property changes. Invokes the cancelable <see cref="Toggle"/> event.</summary>
     /// <remarks>
     /// </remarks>
-    /// <returns>If <see langword="true"/> the <see cref="Toggled"/> event was canceled.</returns>
-    public bool? OnToggled ()
+    /// <returns>If <see langword="true"/> the <see cref="Toggle"/> event was canceled.</returns>
+    public bool? OnToggle ()
     {
         bool ? oldValue = Checked;
         CancelEventArgs<bool?> e = new (ref _checked, ref oldValue);
@@ -141,7 +141,7 @@ public class CheckBox : View
             e.NewValue = !Checked;
         }
 
-        Toggled?.Invoke (this, e);
+        Toggle?.Invoke (this, e);
         if (e.Cancel)
         {
             return e.Cancel;
@@ -158,13 +158,13 @@ public class CheckBox : View
         return true;
     }
 
-    /// <summary>Toggled event, raised when the <see cref="CheckBox"/> is toggled.</summary>
+    /// <summary>Toggle event, raised when the <see cref="CheckBox"/> is toggled.</summary>
     /// <remarks>
     /// <para>
     ///    This event can be cancelled. If cancelled, the <see cref="CheckBox"/> will not change its state.
     /// </para>
     /// </remarks>
-    public event EventHandler<CancelEventArgs<bool?>>? Toggled;
+    public event EventHandler<CancelEventArgs<bool?>>? Toggle;
 
     /// <inheritdoc/>
     protected override void UpdateTextFormatterText ()

+ 2 - 2
UICatalog/Scenarios/AdornmentsEditor.cs

@@ -92,7 +92,7 @@ public class AdornmentsEditor : View
         _diagPaddingCheckBox = new () { Text = "_Diagnostic Padding" };
         _diagPaddingCheckBox.Checked = Diagnostics.FastHasFlags (ViewDiagnosticFlags.Padding);
 
-        _diagPaddingCheckBox.Toggled += (s, e) =>
+        _diagPaddingCheckBox.Toggle += (s, e) =>
                                         {
                                             if (e.NewValue == true)
                                             {
@@ -110,7 +110,7 @@ public class AdornmentsEditor : View
         _diagRulerCheckBox = new () { Text = "_Diagnostic Ruler" };
         _diagRulerCheckBox.Checked = Diagnostics.FastHasFlags (ViewDiagnosticFlags.Ruler);
 
-        _diagRulerCheckBox.Toggled += (s, e) =>
+        _diagRulerCheckBox.Toggle += (s, e) =>
                                       {
                                           if (e.NewValue == true)
                                           {

+ 2 - 2
UICatalog/Scenarios/BorderEditor.cs

@@ -58,7 +58,7 @@ public class BorderEditor : AdornmentEditor
         };
 
 
-        _ckbTitle.Toggled += OnCkbTitleOnToggled;
+        _ckbTitle.Toggle += OnCkbTitleOnToggle;
         Add (_ckbTitle);
 
         return;
@@ -81,6 +81,6 @@ public class BorderEditor : AdornmentEditor
             LayoutSubviews ();
         }
 
-        void OnCkbTitleOnToggled (object sender, CancelEventArgs<bool?> args) { ((Border)AdornmentToEdit).ShowTitle = args.NewValue!.Value; }
+        void OnCkbTitleOnToggle (object sender, CancelEventArgs<bool?> args) { ((Border)AdornmentToEdit).ShowTitle = args.NewValue!.Value; }
     }
 }

+ 1 - 1
UICatalog/Scenarios/Buttons.cs

@@ -387,7 +387,7 @@ public class Buttons : Scenario
             Title = "Enabled",
             Checked = true
         };
-        enableCB.Toggled += (s, e) => { repeatButton.Enabled = !repeatButton.Enabled; };
+        enableCB.Toggle += (s, e) => { repeatButton.Enabled = !repeatButton.Enabled; };
         main.Add (label, repeatButton, enableCB);
 
         main.Ready += (s, e) => radioGroup.Refresh ();

+ 12 - 12
UICatalog/Scenarios/ContentScrolling.cs

@@ -136,9 +136,9 @@ public class ContentScrolling : Scenario
             CanFocus = false
         };
         cbAllowNegativeX.Checked = view.ViewportSettings.HasFlag (ViewportSettings.AllowNegativeX);
-        cbAllowNegativeX.Toggled += AllowNegativeX_Toggled;
+        cbAllowNegativeX.Toggle += AllowNegativeX_Toggle;
 
-        void AllowNegativeX_Toggled (object sender, CancelEventArgs<bool?> e)
+        void AllowNegativeX_Toggle (object sender, CancelEventArgs<bool?> e)
         {
             if (e.NewValue == true)
             {
@@ -160,9 +160,9 @@ public class ContentScrolling : Scenario
             CanFocus = false
         };
         cbAllowNegativeY.Checked = view.ViewportSettings.HasFlag (ViewportSettings.AllowNegativeY);
-        cbAllowNegativeY.Toggled += AllowNegativeY_Toggled;
+        cbAllowNegativeY.Toggle += AllowNegativeY_Toggle;
 
-        void AllowNegativeY_Toggled (object sender, CancelEventArgs<bool?> e)
+        void AllowNegativeY_Toggle (object sender, CancelEventArgs<bool?> e)
         {
             if (e.NewValue == true)
             {
@@ -183,9 +183,9 @@ public class ContentScrolling : Scenario
             CanFocus = false
         };
         cbAllowXGreaterThanContentWidth.Checked = view.ViewportSettings.HasFlag (ViewportSettings.AllowXGreaterThanContentWidth);
-        cbAllowXGreaterThanContentWidth.Toggled += AllowXGreaterThanContentWidth_Toggled;
+        cbAllowXGreaterThanContentWidth.Toggle += AllowXGreaterThanContentWidth_Toggle;
 
-        void AllowXGreaterThanContentWidth_Toggled (object sender, CancelEventArgs<bool?> e)
+        void AllowXGreaterThanContentWidth_Toggle (object sender, CancelEventArgs<bool?> e)
         {
             if (e.NewValue == true)
             {
@@ -207,9 +207,9 @@ public class ContentScrolling : Scenario
             CanFocus = false
         };
         cbAllowYGreaterThanContentHeight.Checked = view.ViewportSettings.HasFlag (ViewportSettings.AllowYGreaterThanContentHeight);
-        cbAllowYGreaterThanContentHeight.Toggled += AllowYGreaterThanContentHeight_Toggled;
+        cbAllowYGreaterThanContentHeight.Toggle += AllowYGreaterThanContentHeight_Toggle;
 
-        void AllowYGreaterThanContentHeight_Toggled (object sender, CancelEventArgs<bool?> e)
+        void AllowYGreaterThanContentHeight_Toggle (object sender, CancelEventArgs<bool?> e)
         {
             if (e.NewValue == true)
             {
@@ -285,9 +285,9 @@ public class ContentScrolling : Scenario
             CanFocus = false
         };
         cbClearOnlyVisible.Checked = view.ViewportSettings.HasFlag (ViewportSettings.ClearContentOnly);
-        cbClearOnlyVisible.Toggled += ClearVisibleContentOnly_Toggled;
+        cbClearOnlyVisible.Toggle += ClearVisibleContentOnly_Toggle;
 
-        void ClearVisibleContentOnly_Toggled (object sender, CancelEventArgs<bool?> e)
+        void ClearVisibleContentOnly_Toggle (object sender, CancelEventArgs<bool?> e)
         {
             if (e.NewValue == true)
             {
@@ -307,9 +307,9 @@ public class ContentScrolling : Scenario
             CanFocus = false
         };
         cbDoNotClipContent.Checked = view.ViewportSettings.HasFlag (ViewportSettings.ClipContentOnly);
-        cbDoNotClipContent.Toggled += ClipVisibleContentOnly_Toggled;
+        cbDoNotClipContent.Toggle += ClipVisibleContentOnly_Toggle;
 
-        void ClipVisibleContentOnly_Toggled (object sender, CancelEventArgs<bool?> e)
+        void ClipVisibleContentOnly_Toggle (object sender, CancelEventArgs<bool?> e)
         {
             if (e.NewValue == true)
             {

+ 3 - 3
UICatalog/Scenarios/DynamicMenuBar.cs

@@ -249,7 +249,7 @@ public class DynamicMenuBar : Scenario
             _btnShortcut.Accept += (s, e) => { TextShortcut.Text = ""; };
             Add (_btnShortcut);
 
-            CkbIsTopLevel.Toggled += (s, e) =>
+            CkbIsTopLevel.Toggle += (s, e) =>
                                      {
                                          if ((_menuItem != null && _menuItem.Parent != null && (bool)CkbIsTopLevel.Checked)
                                              || (_menuItem == null && _hasParent && (bool)CkbIsTopLevel.Checked))
@@ -290,7 +290,7 @@ public class DynamicMenuBar : Scenario
                                          }
                                      };
 
-            CkbSubMenu.Toggled += (s, e) =>
+            CkbSubMenu.Toggle += (s, e) =>
                                   {
                                       if ((bool)CkbSubMenu.Checked)
                                       {
@@ -320,7 +320,7 @@ public class DynamicMenuBar : Scenario
                                       }
                                   };
 
-            CkbNullCheck.Toggled += (s, e) =>
+            CkbNullCheck.Toggle += (s, e) =>
                                     {
                                         if (_menuItem != null)
                                         {

+ 4 - 4
UICatalog/Scenarios/Editor.cs

@@ -897,14 +897,14 @@ public class Editor : Scenario
         {
             X = 0, Y = Pos.Top (txtToFind) + 2, Checked = _matchCase, Text = "Match c_ase"
         };
-        ckbMatchCase.Toggled += (s, e) => _matchCase = (bool)ckbMatchCase.Checked;
+        ckbMatchCase.Toggle += (s, e) => _matchCase = (bool)ckbMatchCase.Checked;
         d.Add (ckbMatchCase);
 
         var ckbMatchWholeWord = new CheckBox
         {
             X = 0, Y = Pos.Top (ckbMatchCase) + 1, Checked = _matchWholeWord, Text = "Match _whole word"
         };
-        ckbMatchWholeWord.Toggled += (s, e) => _matchWholeWord = (bool)ckbMatchWholeWord.Checked;
+        ckbMatchWholeWord.Toggle += (s, e) => _matchWholeWord = (bool)ckbMatchWholeWord.Checked;
         d.Add (ckbMatchWholeWord);
         return d;
     }
@@ -1155,14 +1155,14 @@ public class Editor : Scenario
         {
             X = 0, Y = Pos.Top (txtToFind) + 2, Checked = _matchCase, Text = "Match c_ase"
         };
-        ckbMatchCase.Toggled += (s, e) => _matchCase = (bool)ckbMatchCase.Checked;
+        ckbMatchCase.Toggle += (s, e) => _matchCase = (bool)ckbMatchCase.Checked;
         d.Add (ckbMatchCase);
 
         var ckbMatchWholeWord = new CheckBox
         {
             X = 0, Y = Pos.Top (ckbMatchCase) + 1, Checked = _matchWholeWord, Text = "Match _whole word"
         };
-        ckbMatchWholeWord.Toggled += (s, e) => _matchWholeWord = (bool)ckbMatchWholeWord.Checked;
+        ckbMatchWholeWord.Toggle += (s, e) => _matchWholeWord = (bool)ckbMatchWholeWord.Checked;
         d.Add (ckbMatchWholeWord);
 
         return d;

+ 1 - 1
UICatalog/Scenarios/Images.cs

@@ -42,7 +42,7 @@ public class Images : Scenario
             Enabled = canTrueColor,
             Text = "Use true color"
         };
-        cbUseTrueColor.Toggled += (_, evt) => Application.Force16Colors = !evt.NewValue ?? false;
+        cbUseTrueColor.Toggle += (_, evt) => Application.Force16Colors = !evt.NewValue ?? false;
         Win.Add (cbUseTrueColor);
 
         var btnOpenImage = new Button { X = Pos.Right (cbUseTrueColor) + 2, Y = 0, Text = "Open Image" };

+ 7 - 7
UICatalog/Scenarios/ListViewWithSelection.cs

@@ -34,14 +34,14 @@ public class ListViewWithSelection : Scenario
 
         _customRenderCB = new CheckBox { X = 0, Y = 0, Text = "Use custom rendering" };
         _appWindow.Add (_customRenderCB);
-        _customRenderCB.Toggled += _customRenderCB_Toggled;
+        _customRenderCB.Toggle += _customRenderCB_Toggle;
 
         _allowMarkingCB = new CheckBox
         {
             X = Pos.Right (_customRenderCB) + 1, Y = 0, Text = "Allow Marking", AllowNullChecked = false
         };
         _appWindow.Add (_allowMarkingCB);
-        _allowMarkingCB.Toggled += AllowMarkingCB_Toggled;
+        _allowMarkingCB.Toggle += AllowMarkingCB_Toggle;
 
         _allowMultipleCB = new CheckBox
         {
@@ -51,7 +51,7 @@ public class ListViewWithSelection : Scenario
             Text = "Allow Multi-Select"
         };
         _appWindow.Add (_allowMultipleCB);
-        _allowMultipleCB.Toggled += AllowMultipleCB_Toggled;
+        _allowMultipleCB.Toggle += AllowMultipleCB_Toggle;
 
         _listView = new ListView
         {
@@ -110,7 +110,7 @@ public class ListViewWithSelection : Scenario
         {
             X = Pos.AnchorEnd (k.Length + 3), Y = 0, Text = k, Checked = scrollBar.AutoHideScrollBars
         };
-        keepCheckBox.Toggled += (s, e) => scrollBar.KeepContentAlwaysInViewport = (bool)keepCheckBox.Checked;
+        keepCheckBox.Toggle += (s, e) => scrollBar.KeepContentAlwaysInViewport = (bool)keepCheckBox.Checked;
         _appWindow.Add (keepCheckBox);
 
         Application.Run (_appWindow);
@@ -118,7 +118,7 @@ public class ListViewWithSelection : Scenario
         Application.Shutdown ();
     }
 
-    private void _customRenderCB_Toggled (object sender, CancelEventArgs<bool?> stateEventArgs)
+    private void _customRenderCB_Toggle (object sender, CancelEventArgs<bool?> stateEventArgs)
     {
         if (stateEventArgs.CurrentValue == true)
         {
@@ -132,14 +132,14 @@ public class ListViewWithSelection : Scenario
         _appWindow.SetNeedsDisplay ();
     }
 
-    private void AllowMarkingCB_Toggled (object sender, [NotNull] CancelEventArgs<bool?> stateEventArgs)
+    private void AllowMarkingCB_Toggle (object sender, [NotNull] CancelEventArgs<bool?> stateEventArgs)
     {
         _listView.AllowsMarking = (bool)!stateEventArgs.CurrentValue;
         _allowMultipleCB.Visible = _listView.AllowsMarking;
         _appWindow.SetNeedsDisplay ();
     }
 
-    private void AllowMultipleCB_Toggled (object sender, [NotNull] CancelEventArgs<bool?> stateEventArgs)
+    private void AllowMultipleCB_Toggle (object sender, [NotNull] CancelEventArgs<bool?> stateEventArgs)
     {
         _listView.AllowsMultipleSelection = (bool)!stateEventArgs.CurrentValue;
         _appWindow.SetNeedsDisplay ();

+ 2 - 2
UICatalog/Scenarios/Mouse.cs

@@ -67,7 +67,7 @@ public class Mouse : Scenario
             Y = Pos.Bottom (ml),
             Title = "_Want Continuous Button Pressed"
         };
-        cbWantContinuousPresses.Toggled += (s, e) => { win.WantContinuousButtonPressed = !win.WantContinuousButtonPressed; };
+        cbWantContinuousPresses.Toggle += (s, e) => { win.WantContinuousButtonPressed = !win.WantContinuousButtonPressed; };
 
         win.Add (cbWantContinuousPresses);
 
@@ -79,7 +79,7 @@ public class Mouse : Scenario
         };
         cbHighlightOnPress.Checked = win.HighlightStyle == (HighlightStyle.Pressed | HighlightStyle.PressedOutside);
 
-        cbHighlightOnPress.Toggled += (s, e) =>
+        cbHighlightOnPress.Toggle += (s, e) =>
                                       {
                                           if (e.NewValue == true)
                                           {

+ 4 - 4
UICatalog/Scenarios/PosAlignDemo.cs

@@ -98,7 +98,7 @@ public sealed class PosAlignDemo : Scenario
             endToStartCheckBox.Y = Pos.Align (_vertAligner.Alignment);
         }
 
-        endToStartCheckBox.Toggled += (s, e) =>
+        endToStartCheckBox.Toggle += (s, e) =>
                                       {
                                           if (dimension == Dimension.Width)
                                           {
@@ -138,7 +138,7 @@ public sealed class PosAlignDemo : Scenario
             ignoreFirstOrLast.Y = Pos.Align (_vertAligner.Alignment);
         }
 
-        ignoreFirstOrLast.Toggled += (s, e) =>
+        ignoreFirstOrLast.Toggle += (s, e) =>
                                      {
                                          if (dimension == Dimension.Width)
                                          {
@@ -178,7 +178,7 @@ public sealed class PosAlignDemo : Scenario
             addSpacesBetweenItems.Y = Pos.Align (_vertAligner.Alignment);
         }
 
-        addSpacesBetweenItems.Toggled += (s, e) =>
+        addSpacesBetweenItems.Toggle += (s, e) =>
                                          {
                                              if (dimension == Dimension.Width)
                                              {
@@ -217,7 +217,7 @@ public sealed class PosAlignDemo : Scenario
             margin.Y = Pos.Align (_vertAligner.Alignment);
         }
 
-        margin.Toggled += (s, e) =>
+        margin.Toggle += (s, e) =>
                           {
                               if (dimension == Dimension.Width)
                               {

+ 1 - 1
UICatalog/Scenarios/ProgressBarStyles.cs

@@ -286,7 +286,7 @@ public class ProgressBarStyles : Scenario
                                               marqueesContinuousPB.ProgressBarFormat = (ProgressBarFormat)e.SelectedItem;
                                           };
 
-        ckbBidirectional.Toggled += (s, e) =>
+        ckbBidirectional.Toggle += (s, e) =>
                                     {
                                         ckbBidirectional.Checked = marqueesBlocksPB.BidirectionalMarquee =
                                                                        marqueesContinuousPB.BidirectionalMarquee = (bool)!e.CurrentValue;

+ 4 - 4
UICatalog/Scenarios/Scrolling.cs

@@ -174,7 +174,7 @@ public class Scrolling : Scenario
             X = Pos.Left (scrollView), Y = Pos.Bottom (ahCheckBox), Text = k, Checked = scrollView.AutoHideScrollBars
         };
 
-        hCheckBox.Toggled += (s, e) =>
+        hCheckBox.Toggle += (s, e) =>
                              {
                                  if (ahCheckBox.Checked == false)
                                  {
@@ -187,7 +187,7 @@ public class Scrolling : Scenario
                                  }
                              };
 
-        vCheckBox.Toggled += (s, e) =>
+        vCheckBox.Toggle += (s, e) =>
                              {
                                  if (ahCheckBox.Checked == false)
                                  {
@@ -200,7 +200,7 @@ public class Scrolling : Scenario
                                  }
                              };
 
-        ahCheckBox.Toggled += (s, e) =>
+        ahCheckBox.Toggle += (s, e) =>
                               {
                                   scrollView.AutoHideScrollBars = (bool)ahCheckBox.Checked;
                                   hCheckBox.Checked = true;
@@ -208,7 +208,7 @@ public class Scrolling : Scenario
                               };
         app.Add (ahCheckBox);
 
-        keepCheckBox.Toggled += (s, e) => scrollView.KeepContentAlwaysInViewport = (bool)keepCheckBox.Checked;
+        keepCheckBox.Toggle += (s, e) => scrollView.KeepContentAlwaysInViewport = (bool)keepCheckBox.Checked;
         app.Add (keepCheckBox);
 
         var count = 0;

+ 5 - 5
UICatalog/Scenarios/Shortcuts.cs

@@ -107,11 +107,11 @@ public class Shortcuts : Scenario
             KeyBindingScope = KeyBindingScope.HotKey,
         };
 
-        ((CheckBox)vShortcut3.CommandView).Toggled += (s, e) =>
+        ((CheckBox)vShortcut3.CommandView).Toggle += (s, e) =>
                                                       {
                                                           if (vShortcut3.CommandView is CheckBox cb)
                                                           {
-                                                              eventSource.Add ($"Toggled: {cb.Text}");
+                                                              eventSource.Add ($"Toggle: {cb.Text}");
                                                               eventLog.MoveDown ();
 
                                                               var max = 0;
@@ -166,11 +166,11 @@ public class Shortcuts : Scenario
             CommandView = new CheckBox { Text = "_CanFocus" },
         };
 
-        ((CheckBox)vShortcut5.CommandView).Toggled += (s, e) =>
+        ((CheckBox)vShortcut5.CommandView).Toggle += (s, e) =>
                                                      {
                                                          if (vShortcut5.CommandView is CheckBox cb)
                                                          {
-                                                             eventSource.Add ($"Toggled: {cb.Text}");
+                                                             eventSource.Add ($"Toggle: {cb.Text}");
                                                              eventLog.MoveDown ();
 
                                                              foreach (Shortcut peer in Application.Top.Subviews.Where (v => v is Shortcut)!)
@@ -372,7 +372,7 @@ public class Shortcuts : Scenario
             }
         }
 
-        //((CheckBox)vShortcut5.CommandView).OnToggled ();
+        //((CheckBox)vShortcut5.CommandView).OnToggle ();
     }
 
     private void Button_Clicked (object sender, HandledEventArgs e)

+ 1 - 1
UICatalog/Scenarios/Sliders.cs

@@ -236,7 +236,7 @@ public class Sliders : Scenario
             Y = Pos.Bottom (optionsSlider)
         };
 
-        dimAutoUsesMin.Toggled += (sender, e) =>
+        dimAutoUsesMin.Toggle += (sender, e) =>
                                   {
                                       foreach (Slider s in app.Subviews.OfType<Slider> ())
                                       {

+ 2 - 2
UICatalog/Scenarios/SpinnerStyles.cs

@@ -164,9 +164,9 @@ public class SpinnerViewStyles : Scenario
                                           }
                                       };
 
-        ckbReverse.Toggled += (s, e) => { spinner.SpinReverse = (bool)!e.CurrentValue; };
+        ckbReverse.Toggle += (s, e) => { spinner.SpinReverse = (bool)!e.CurrentValue; };
 
-        ckbBounce.Toggled += (s, e) => { spinner.SpinBounce = (bool)!e.CurrentValue; };
+        ckbBounce.Toggle += (s, e) => { spinner.SpinBounce = (bool)!e.CurrentValue; };
 
         app.Unloaded += App_Unloaded;
 

+ 3 - 3
UICatalog/Scenarios/Text.cs

@@ -116,7 +116,7 @@ public class Text : Scenario
             Checked = textView.WordWrap,
             Text = "_Word Wrap"
         };
-        chxWordWrap.Toggled += (s, e) => textView.WordWrap = (bool)e.NewValue;
+        chxWordWrap.Toggle += (s, e) => textView.WordWrap = (bool)e.NewValue;
         Win.Add (chxWordWrap);
 
         // TextView captures Tabs (so users can enter /t into text) by default;
@@ -130,7 +130,7 @@ public class Text : Scenario
             Text = "_Capture Tabs"
         };
 
-        chxMultiline.Toggled += (s, e) =>
+        chxMultiline.Toggle += (s, e) =>
                                 {
                                     textView.Multiline = (bool)e.NewValue;
 
@@ -148,7 +148,7 @@ public class Text : Scenario
         Key keyTab = textView.KeyBindings.GetKeyFromCommands (Command.Tab);
         Key keyBackTab = textView.KeyBindings.GetKeyFromCommands (Command.BackTab);
 
-        chxCaptureTabs.Toggled += (s, e) =>
+        chxCaptureTabs.Toggle += (s, e) =>
                                   {
                                       if (e.NewValue == true)
                                       {

+ 3 - 3
UICatalog/Scenarios/TextAlignmentAndDirection.cs

@@ -484,7 +484,7 @@ public class TextAlignmentAndDirection : Scenario
             Enabled = false
         };
 
-        justifyCheckbox.Toggled += (s, e) => ToggleJustify (e.CurrentValue is { } && (bool)e.CurrentValue);
+        justifyCheckbox.Toggle += (s, e) => ToggleJustify (e.CurrentValue is { } && (bool)e.CurrentValue);
 
         justifyOptions.SelectedItemChanged += (s, e) => { ToggleJustify (false, true); };
 
@@ -502,7 +502,7 @@ public class TextAlignmentAndDirection : Scenario
         };
         wrapCheckbox.Checked = wrapCheckbox.TextFormatter.WordWrap;
 
-        wrapCheckbox.Toggled += (s, e) =>
+        wrapCheckbox.Toggle += (s, e) =>
                                 {
                                     if (e.CurrentValue == true)
                                     {
@@ -534,7 +534,7 @@ public class TextAlignmentAndDirection : Scenario
         };
         autoSizeCheckbox.Checked = autoSizeCheckbox.TextFormatter.AutoSize;
 
-        autoSizeCheckbox.Toggled += (s, e) =>
+        autoSizeCheckbox.Toggle += (s, e) =>
                                     {
                                         if (e.CurrentValue == true)
                                         {

+ 1 - 1
UICatalog/Scenarios/TextFormatterDemo.cs

@@ -133,7 +133,7 @@ public class TextFormatterDemo : Scenario
             label = multipleLines [i];
         }
 
-        unicodeCheckBox.Toggled += (s, e) =>
+        unicodeCheckBox.Toggle += (s, e) =>
                                    {
                                        for (int i = 0; i < alignments.Count; i++)
                                        {

+ 4 - 4
UICatalog/Scenarios/TileViewNesting.cs

@@ -31,16 +31,16 @@ public class TileViewNesting : Scenario
         _textField.TextChanged += (s, e) => SetupTileView ();
 
         _cbHorizontal = new() { X = Pos.Right (_textField) + 1, Text = "Horizontal" };
-        _cbHorizontal.Toggled += (s, e) => SetupTileView ();
+        _cbHorizontal.Toggle += (s, e) => SetupTileView ();
 
         _cbBorder = new() { X = Pos.Right (_cbHorizontal) + 1, Text = "Border" };
-        _cbBorder.Toggled += (s, e) => SetupTileView ();
+        _cbBorder.Toggle += (s, e) => SetupTileView ();
 
         _cbTitles = new() { X = Pos.Right (_cbBorder) + 1, Text = "Titles" };
-        _cbTitles.Toggled += (s, e) => SetupTileView ();
+        _cbTitles.Toggle += (s, e) => SetupTileView ();
 
         _cbUseLabels = new() { X = Pos.Right (_cbTitles) + 1, Text = "Use Labels" };
-        _cbUseLabels.Toggled += (s, e) => SetupTileView ();
+        _cbUseLabels.Toggle += (s, e) => SetupTileView ();
 
         _workArea = new() { X = 0, Y = 1, Width = Dim.Fill (), Height = Dim.Fill () };
 

+ 1 - 1
UICatalog/Scenarios/TrueColors.cs

@@ -46,7 +46,7 @@ public class TrueColors : Scenario
             Enabled = canTrueColor,
             Text = "Force 16 colors"
         };
-        cbUseTrueColor.Toggled += (_, evt) => { Application.Force16Colors = evt.NewValue ?? false; };
+        cbUseTrueColor.Toggle += (_, evt) => { Application.Force16Colors = evt.NewValue ?? false; };
         app.Add (cbUseTrueColor);
 
         y += 2;

+ 2 - 2
UICatalog/Scenarios/Wizards.cs

@@ -243,7 +243,7 @@ public class Wizards : Scenario
                                            };
                                            thirdStep.Add (progLbl, progressBar);
                                            thirdStep.Enabled = (bool)thirdStepEnabledCeckBox.Checked;
-                                           thirdStepEnabledCeckBox.Toggled += (s, e) => { thirdStep.Enabled = (bool)thirdStepEnabledCeckBox.Checked; };
+                                           thirdStepEnabledCeckBox.Toggle += (s, e) => { thirdStep.Enabled = (bool)thirdStepEnabledCeckBox.Checked; };
 
                                            // Add 4th step
                                            var fourthStep = new WizardStep { Title = "Step Four" };
@@ -331,7 +331,7 @@ public class Wizards : Scenario
                                                "This step only shows if it was enabled on the other last step.";
                                            finalFinalStep.Enabled = (bool)thirdStepEnabledCeckBox.Checked;
 
-                                           finalFinalStepEnabledCeckBox.Toggled += (s, e) =>
+                                           finalFinalStepEnabledCeckBox.Toggle += (s, e) =>
                                                                                    {
                                                                                        finalFinalStep.Enabled = (bool)finalFinalStepEnabledCeckBox.Checked;
                                                                                    };

+ 4 - 4
UnitTests/Views/CheckBoxTests.cs

@@ -174,7 +174,7 @@ public class CheckBoxTests (ITestOutputHelper output)
     {
         var toggled = false;
         var ckb = new CheckBox ();
-        ckb.Toggled += (s, e) => toggled = true;
+        ckb.Toggle += (s, e) => toggled = true;
 
         Assert.False (ckb.Checked);
         Assert.False (toggled);
@@ -481,18 +481,18 @@ public class CheckBoxTests (ITestOutputHelper output)
         var ckb = new CheckBox { AllowNullChecked = true };
         var checkedInvoked = false;
 
-        ckb.Toggled += CheckBoxToggled;
+        ckb.Toggle += CheckBoxToggle;
 
         ckb.Checked = initialState;
         Assert.Equal (initialState, ckb.Checked);
-        bool? ret = ckb.OnToggled ();
+        bool? ret = ckb.OnToggle ();
         Assert.True (ret);
         Assert.True (checkedInvoked);
         Assert.Equal (initialState, ckb.Checked);
 
         return;
 
-        void CheckBoxToggled (object sender, CancelEventArgs e)
+        void CheckBoxToggle (object sender, CancelEventArgs e)
         {
             checkedInvoked = true;
             e.Cancel = true;