Browse Source

merged !!! woot.

Tigger Kindel 2 years ago
parent
commit
791976428e
100 changed files with 1930 additions and 1354 deletions
  1. 1 1
      Example/Example.cs
  2. 1 1
      README.md
  3. 4 17
      Terminal.Gui/Configuration/ConfigurationManager.cs
  4. 36 0
      Terminal.Gui/Configuration/ConfigurationManagerEventArgs.cs
  5. 3 21
      Terminal.Gui/Configuration/ThemeScope.cs
  6. 5 5
      Terminal.Gui/ConsoleDrivers/WindowsDriver.cs
  7. 56 38
      Terminal.Gui/Core/Application.cs
  8. 3 3
      Terminal.Gui/Core/Autocomplete/Autocomplete.cs
  9. 0 27
      Terminal.Gui/Core/Canvas.cs
  10. 3 22
      Terminal.Gui/Core/CollectionNavigator.cs
  11. 29 0
      Terminal.Gui/Core/GrabMouseEventArgs.cs
  12. 34 0
      Terminal.Gui/Core/KeyChangedEventArgs.cs
  13. 24 0
      Terminal.Gui/Core/KeyEventEventArgs.cs
  14. 22 0
      Terminal.Gui/Core/KeystrokeNavigatorEventArgs.cs
  15. 2 2
      Terminal.Gui/Core/MainLoop.cs
  16. 31 0
      Terminal.Gui/Core/MouseEventEventArgs.cs
  17. 30 0
      Terminal.Gui/Core/MouseFlagsChangedEventArgs.cs
  18. 23 0
      Terminal.Gui/Core/PointEventArgs.cs
  19. 32 0
      Terminal.Gui/Core/ResizedEventArgs.cs
  20. 24 0
      Terminal.Gui/Core/RunStateEventArgs.cs
  21. 26 0
      Terminal.Gui/Core/SizeChangedEventArgs.cs
  22. 33 0
      Terminal.Gui/Core/SuperViewChangedEventArgs.cs
  23. 2 2
      Terminal.Gui/Core/TextFormatter.cs
  24. 32 0
      Terminal.Gui/Core/TimeoutEventArgs.cs
  25. 46 0
      Terminal.Gui/Core/TitleEventArgs.cs
  26. 30 0
      Terminal.Gui/Core/ToggleEventArgs.cs
  27. 58 63
      Terminal.Gui/Core/Toplevel.cs
  28. 51 0
      Terminal.Gui/Core/ToplevelEventArgs.cs
  29. 64 137
      Terminal.Gui/Core/View.cs
  30. 80 0
      Terminal.Gui/Core/ViewEventArgs.cs
  31. 5 22
      Terminal.Gui/Core/Window.cs
  32. 2 2
      Terminal.Gui/Views/Button.cs
  33. 43 0
      Terminal.Gui/Views/CellActivatedEventArgs.cs
  34. 5 4
      Terminal.Gui/Views/CheckBox.cs
  35. 2 2
      Terminal.Gui/Views/ColorPicker.cs
  36. 18 18
      Terminal.Gui/Views/ComboBox.cs
  37. 32 0
      Terminal.Gui/Views/ContentsChangedEventArgs.cs
  38. 7 7
      Terminal.Gui/Views/ContextMenu.cs
  39. 5 38
      Terminal.Gui/Views/DateField.cs
  40. 43 0
      Terminal.Gui/Views/DateTimeEventArgs.cs
  41. 2 45
      Terminal.Gui/Views/FrameView.cs
  42. 9 41
      Terminal.Gui/Views/HexView.cs
  43. 70 0
      Terminal.Gui/Views/HexViewEventArgs.cs
  44. 36 0
      Terminal.Gui/Views/HistoryTextItem.cs
  45. 3 3
      Terminal.Gui/Views/Label.cs
  46. 6 55
      Terminal.Gui/Views/ListView.cs
  47. 52 0
      Terminal.Gui/Views/ListViewEventArgs.cs
  48. 16 80
      Terminal.Gui/Views/Menu.cs
  49. 98 0
      Terminal.Gui/Views/MenuEventArgs.cs
  50. 2 28
      Terminal.Gui/Views/RadioGroup.cs
  51. 5 5
      Terminal.Gui/Views/ScrollBarView.cs
  52. 2 2
      Terminal.Gui/Views/ScrollView.cs
  53. 63 0
      Terminal.Gui/Views/SelectedCellChangedEventArgs.cs
  54. 29 0
      Terminal.Gui/Views/SelectedItemChangedArgs.cs
  55. 38 0
      Terminal.Gui/Views/SplitterEventArgs.cs
  56. 31 0
      Terminal.Gui/Views/TabChangedEventArgs.cs
  57. 35 0
      Terminal.Gui/Views/TabMouseEventArgs.cs
  58. 1 59
      Terminal.Gui/Views/TabView.cs
  59. 5 98
      Terminal.Gui/Views/TableView.cs
  60. 31 0
      Terminal.Gui/Views/TextChangedEventArgs.cs
  61. 34 0
      Terminal.Gui/Views/TextChangingEventArgs.cs
  62. 7 31
      Terminal.Gui/Views/TextField.cs
  63. 20 75
      Terminal.Gui/Views/TextView.cs
  64. 7 73
      Terminal.Gui/Views/TileView.cs
  65. 5 5
      Terminal.Gui/Views/TimeField.cs
  66. 42 0
      Terminal.Gui/Views/TitleEventArgs.cs
  67. 2 2
      Terminal.Gui/Views/TreeView.cs
  68. 1 1
      Terminal.Gui/Windows/Dialog.cs
  69. 6 6
      Terminal.Gui/Windows/FileDialog.cs
  70. 1 1
      Terminal.Gui/Windows/MessageBox.cs
  71. 28 78
      Terminal.Gui/Windows/Wizard.cs
  72. 54 0
      Terminal.Gui/Windows/WizardEventArgs.cs
  73. 9 6
      UICatalog/KeyBindingsDialog.cs
  74. 4 4
      UICatalog/Scenarios/ASCIICustomButton.cs
  75. 13 13
      UICatalog/Scenarios/AllViewsTester.cs
  76. 5 5
      UICatalog/Scenarios/AutoSizeAndDirectionText.cs
  77. 11 11
      UICatalog/Scenarios/BackgroundWorkerCollection.cs
  78. 3 3
      UICatalog/Scenarios/BordersComparisons.cs
  79. 18 18
      UICatalog/Scenarios/BordersOnContainers.cs
  80. 14 14
      UICatalog/Scenarios/Buttons.cs
  81. 7 5
      UICatalog/Scenarios/CharacterMap.cs
  82. 7 4
      UICatalog/Scenarios/Clipping.cs
  83. 4 4
      UICatalog/Scenarios/CollectionNavigatorTester.cs
  84. 2 2
      UICatalog/Scenarios/ColorPicker.cs
  85. 4 4
      UICatalog/Scenarios/ComboBoxIteration.cs
  86. 5 5
      UICatalog/Scenarios/ComputedLayout.cs
  87. 2 2
      UICatalog/Scenarios/ConfigurationEditor.cs
  88. 3 3
      UICatalog/Scenarios/ContextMenus.cs
  89. 9 9
      UICatalog/Scenarios/CsvEditor.cs
  90. 7 7
      UICatalog/Scenarios/Dialogs.cs
  91. 26 26
      UICatalog/Scenarios/DynamicMenuBar.cs
  92. 16 16
      UICatalog/Scenarios/DynamicStatusBar.cs
  93. 27 27
      UICatalog/Scenarios/Editor.cs
  94. 10 10
      UICatalog/Scenarios/Frames.cs
  95. 2 2
      UICatalog/Scenarios/HexEditor.cs
  96. 3 3
      UICatalog/Scenarios/InteractiveTree.cs
  97. 1 1
      UICatalog/Scenarios/InvertColors.cs
  98. 4 4
      UICatalog/Scenarios/Keys.cs
  99. 15 15
      UICatalog/Scenarios/LabelsAsButtons.cs
  100. 11 11
      UICatalog/Scenarios/ListViewWithSelection.cs

+ 1 - 1
Example/Example.cs

@@ -57,7 +57,7 @@ public class ExampleWindow : Window {
 		};
 
 		// When login button is clicked display a message popup
-		btnLogin.Clicked += () => {
+		btnLogin.Clicked += (s,e) => {
 			if (usernameText.Text == "admin" && passwordText.Text == "password") {
 				MessageBox.Query ("Logging In", "Login Successful", "Ok");
 				Application.RequestStop ();

+ 1 - 1
README.md

@@ -121,7 +121,7 @@ public class ExampleWindow : Window {
 		};
 
 		// When login button is clicked display a message popup
-		btnLogin.Clicked += () => {
+		btnLogin.Clicked += (s,e) => {
 			if (usernameText.Text == "admin" && passwordText.Text == "password") {
 				MessageBox.Query ("Logging In", "Login Successful", "Ok");
 				Application.RequestStop ();

+ 4 - 17
Terminal.Gui/Configuration/ConfigurationManager.cs

@@ -301,19 +301,6 @@ namespace Terminal.Gui.Configuration {
 			return stream;
 		}
 
-		/// <summary>
-		/// Event arguments for the <see cref="ConfigurationManager"/> events.
-		/// </summary>
-		public class ConfigurationManagerEventArgs : EventArgs {
-
-			/// <summary>
-			/// Initializes a new instance of <see cref="ConfigurationManagerEventArgs"/>
-			/// </summary>
-			public ConfigurationManagerEventArgs ()
-			{
-			}
-		}
-
 		/// <summary>
 		/// Gets or sets whether the <see cref="ConfigurationManager"/> should throw an exception if it encounters 
 		/// an error on deserialization. If <see langword="false"/> (the default), the error is logged and printed to the 
@@ -353,14 +340,14 @@ namespace Terminal.Gui.Configuration {
 		public static void OnUpdated ()
 		{
 			Debug.WriteLine ($"ConfigurationManager.OnApplied()");
-			Updated?.Invoke (new ConfigurationManagerEventArgs ());
+			Updated?.Invoke (null, new ConfigurationManagerEventArgs ());
 		}
 
 		/// <summary>
 		/// Event fired when the configuration has been updated from a configuration source.  
 		/// application.
 		/// </summary>
-		public static event Action<ConfigurationManagerEventArgs>? Updated;
+		public static event EventHandler<ConfigurationManagerEventArgs>? Updated;
 
 		/// <summary>
 		/// Resets the state of <see cref="ConfigurationManager"/>. Should be called whenever a new app session
@@ -440,14 +427,14 @@ namespace Terminal.Gui.Configuration {
 		public static void OnApplied ()
 		{
 			Debug.WriteLine ($"ConfigurationManager.OnApplied()");
-			Applied?.Invoke (new ConfigurationManagerEventArgs ());
+			Applied?.Invoke (null, new ConfigurationManagerEventArgs ());
 		}
 
 		/// <summary>
 		/// Event fired when an updated configuration has been applied to the  
 		/// application.
 		/// </summary>
-		public static event Action<ConfigurationManagerEventArgs>? Applied;
+		public static event EventHandler<ConfigurationManagerEventArgs>? Applied;
 
 		/// <summary>
 		/// Name of the running application. By default this property is set to the application's assembly name.

+ 36 - 0
Terminal.Gui/Configuration/ConfigurationManagerEventArgs.cs

@@ -0,0 +1,36 @@
+using System;
+
+#nullable enable
+
+namespace Terminal.Gui.Configuration {
+	/// <summary>
+	/// Event arguments for the <see cref="ConfigurationManager"/> events.
+	/// </summary>
+	public class ConfigurationManagerEventArgs : EventArgs {
+
+		/// <summary>
+		/// Initializes a new instance of <see cref="ConfigurationManagerEventArgs"/>
+		/// </summary>
+		public ConfigurationManagerEventArgs ()
+		{
+		}
+	}
+
+	/// <summary>
+	/// Event arguments for the <see cref="ConfigurationManager.ThemeManager"/> events.
+	/// </summary>
+	public class ThemeManagerEventArgs : EventArgs {
+		/// <summary>
+		/// The name of the new active theme..
+		/// </summary>
+		public string NewTheme { get; set; } = string.Empty;
+
+		/// <summary>
+		/// Initializes a new instance of <see cref="ThemeManagerEventArgs"/>
+		/// </summary>
+		public ThemeManagerEventArgs (string newTheme)
+		{
+			NewTheme = newTheme;
+		}
+	}
+}

+ 3 - 21
Terminal.Gui/Configuration/ThemeScope.cs

@@ -110,7 +110,7 @@ namespace Terminal.Gui.Configuration {
 		/// 		}
 		/// 	}
 		/// </code></example> 
-		public class ThemeManager : IDictionary<string, ThemeScope> {
+		public partial class ThemeManager : IDictionary<string, ThemeScope> {
 			private static readonly ThemeManager _instance = new ThemeManager ();
 			static ThemeManager () { } // Make sure it's truly lazy
 			private ThemeManager () { } // Prevent instantiation outside
@@ -152,38 +152,20 @@ namespace Terminal.Gui.Configuration {
 				}
 			}
 
-			/// <summary>
-			/// Event arguments for the <see cref="ThemeManager"/> events.
-			/// </summary>
-			public class ThemeManagerEventArgs : EventArgs {
-				/// <summary>
-				/// The name of the new active theme..
-				/// </summary>
-				public string NewTheme { get; set; } = string.Empty;
-
-				/// <summary>
-				/// Initializes a new instance of <see cref="ThemeManagerEventArgs"/>
-				/// </summary>
-				public ThemeManagerEventArgs (string newTheme)
-				{
-					NewTheme = newTheme;
-				}
-			}
-
 			/// <summary>
 			/// Called when the selected theme has changed. Fires the <see cref="ThemeChanged"/> event.
 			/// </summary>
 			internal void OnThemeChanged (string theme)
 			{
 				Debug.WriteLine ($"Themes.OnThemeChanged({theme}) -> {Theme}");
-				ThemeChanged?.Invoke (new ThemeManagerEventArgs (theme));
+				ThemeChanged?.Invoke (this, new ThemeManagerEventArgs (theme));
 			}
 
 			/// <summary>
 			/// Event fired he selected theme has changed.
 			/// application.
 			/// </summary>
-			public event Action<ThemeManagerEventArgs>? ThemeChanged;
+			public event EventHandler<ThemeManagerEventArgs>? ThemeChanged;
 
 			/// <summary>
 			/// Holds the <see cref="ThemeScope"/> definitions. 

+ 5 - 5
Terminal.Gui/ConsoleDrivers/WindowsDriver.cs

@@ -743,8 +743,8 @@ namespace Terminal.Gui {
 
 			mLoop.ProcessInput = (e) => ProcessInput (e);
 
-			mLoop.WinChanged = (e) => {
-				ChangeWin (e);
+			mLoop.WinChanged = (s,e) => {
+				ChangeWin (e.Size);
 			};
 		}
 
@@ -1868,8 +1868,8 @@ namespace Terminal.Gui {
 		/// <summary>
 		/// Invoked when the window is changed.
 		/// </summary>
-		public Action<Size> WinChanged;
-
+		public EventHandler<SizeChangedEventArgs> WinChanged;
+		
 		public WindowsMainLoop (ConsoleDriver consoleDriver = null)
 		{
 			this.consoleDriver = consoleDriver ?? throw new ArgumentNullException ("Console driver instance must be provided.");
@@ -1991,7 +1991,7 @@ namespace Terminal.Gui {
 			}
 			if (winChanged) {
 				winChanged = false;
-				WinChanged?.Invoke (windowSize);
+				WinChanged?.Invoke (this, new SizeChangedEventArgs(windowSize));
 			}
 		}
 	}

+ 56 - 38
Terminal.Gui/Core/Application.cs

@@ -59,7 +59,7 @@ namespace Terminal.Gui {
 	///     to the mainloop, allowing user code to use async/await.
 	///   </para>
 	/// </remarks>
-	public static class Application {
+	public static partial class Application {
 		static readonly Stack<Toplevel> toplevels = new Stack<Toplevel> ();
 
 		/// <summary>
@@ -162,15 +162,15 @@ namespace Terminal.Gui {
 				if (alternateForwardKey != value) {
 					var oldKey = alternateForwardKey;
 					alternateForwardKey = value;
-					OnAlternateForwardKeyChanged (oldKey);
+					OnAlternateForwardKeyChanged (new KeyChangedEventArgs (oldKey, value));
 				}
 			}
 		}
 
-		static void OnAlternateForwardKeyChanged (Key oldKey)
+		static void OnAlternateForwardKeyChanged (KeyChangedEventArgs e)
 		{
 			foreach (var top in toplevels.ToArray ()) {
-				top.OnAlternateForwardKeyChanged (oldKey);
+				top.OnAlternateForwardKeyChanged (e);
 			}
 		}
 
@@ -186,12 +186,12 @@ namespace Terminal.Gui {
 				if (alternateBackwardKey != value) {
 					var oldKey = alternateBackwardKey;
 					alternateBackwardKey = value;
-					OnAlternateBackwardKeyChanged (oldKey);
+					OnAlternateBackwardKeyChanged (new KeyChangedEventArgs (oldKey, value));
 				}
 			}
 		}
 
-		static void OnAlternateBackwardKeyChanged (Key oldKey)
+		static void OnAlternateBackwardKeyChanged (KeyChangedEventArgs oldKey)
 		{
 			foreach (var top in toplevels.ToArray ()) {
 				top.OnAlternateBackwardKeyChanged (oldKey);
@@ -210,7 +210,7 @@ namespace Terminal.Gui {
 				if (quitKey != value) {
 					var oldKey = quitKey;
 					quitKey = value;
-					OnQuitKeyChanged (oldKey);
+					OnQuitKeyChanged (new KeyChangedEventArgs (oldKey, value));
 				}
 			}
 		}
@@ -222,11 +222,11 @@ namespace Terminal.Gui {
 		/// </summary>
 		public static List<CultureInfo> SupportedCultures => supportedCultures;
 
-		static void OnQuitKeyChanged (Key oldKey)
+		static void OnQuitKeyChanged (KeyChangedEventArgs e)
 		{
 			// Duplicate the list so if it changes during enumeration we're safe
 			foreach (var top in toplevels.ToArray ()) {
-				top.OnQuitKeyChanged (oldKey);
+				top.OnQuitKeyChanged (e);
 			}
 		}
 
@@ -257,7 +257,7 @@ namespace Terminal.Gui {
 		///	<see cref="Begin(Toplevel)"/> must also subscribe to <see cref="NotifyStopRunState"/>
 		///	and manually dispose of the <see cref="RunState"/> token when the application is done.
 		/// </remarks>
-		public static event Action<RunState> NotifyNewRunState;
+		public static event EventHandler<RunStateEventArgs> NotifyNewRunState;
 
 		/// <summary>
 		/// Notify that a existent <see cref="RunState"/> is stopping (<see cref="End(RunState)"/> was called).
@@ -267,7 +267,7 @@ namespace Terminal.Gui {
 		///	<see cref="Begin(Toplevel)"/> must also subscribe to <see cref="NotifyStopRunState"/>
 		///	and manually dispose of the <see cref="RunState"/> token when the application is done.
 		/// </remarks>
-		public static event Action<Toplevel> NotifyStopRunState;
+		public static event EventHandler<ToplevelEventArgs> NotifyStopRunState;
 
 		/// <summary>
 		///   This event is raised on each iteration of the <see cref="MainLoop"/>. 
@@ -730,15 +730,25 @@ namespace Terminal.Gui {
 		/// </summary>
 		public static View MouseGrabView => mouseGrabView;
 
+		/// <summary>
+		/// Event to be invoked when a view want grab the mouse which can be canceled.
+		/// </summary>
+		public static event EventHandler<GrabMouseEventArgs> GrabbingMouse;
+
+		/// <summary>
+		/// Event to be invoked when a view want ungrab the mouse which can be canceled.
+		/// </summary>
+		public static event EventHandler<GrabMouseEventArgs> UnGrabbingMouse;
+
 		/// <summary>
 		/// Event to be invoked when a view grab the mouse.
 		/// </summary>
-		public static event Action<View> GrabbedMouse;
+		public static event EventHandler<ViewEventArgs> GrabbedMouse;
 
 		/// <summary>
 		/// Event to be invoked when a view ungrab the mouse.
 		/// </summary>
-		public static event Action<View> UnGrabbedMouse;
+		public static event EventHandler<ViewEventArgs> UnGrabbedMouse;
 
 		/// <summary>
 		/// Grabs the mouse, forcing all mouse events to be routed to the specified view until UngrabMouse is called.
@@ -749,9 +759,11 @@ namespace Terminal.Gui {
 		{
 			if (view == null)
 				return;
-			OnGrabbedMouse (view);
-			mouseGrabView = view;
-			Driver.UncookMouse ();
+			if (!OnGrabbingMouse (view)) {
+				OnGrabbedMouse (view);
+				mouseGrabView = view;
+				Driver.UncookMouse ();
+			}
 		}
 
 		/// <summary>
@@ -761,23 +773,43 @@ namespace Terminal.Gui {
 		{
 			if (mouseGrabView == null)
 				return;
-			OnUnGrabbedMouse (mouseGrabView);
-			mouseGrabView = null;
-			Driver.CookMouse ();
+			if (!OnUnGrabbingMouse (mouseGrabView)) {
+				OnUnGrabbedMouse (mouseGrabView);
+				mouseGrabView = null;
+				Driver.CookMouse ();
+			}
+		}
+
+		static bool OnGrabbingMouse (View view)
+		{
+			if (view == null)
+				return false;
+			var evArgs = new GrabMouseEventArgs (view);
+			GrabbingMouse?.Invoke (view, evArgs);
+			return evArgs.Cancel;
+		}
+
+		static bool OnUnGrabbingMouse (View view)
+		{
+			if (view == null)
+				return false;
+			var evArgs = new GrabMouseEventArgs (view);
+			UnGrabbingMouse?.Invoke (view, evArgs);
+			return evArgs.Cancel;
 		}
 
 		static void OnGrabbedMouse (View view)
 		{
 			if (view == null)
 				return;
-			GrabbedMouse?.Invoke (view);
+			GrabbedMouse?.Invoke (view, new ViewEventArgs (view));
 		}
 
 		static void OnUnGrabbedMouse (View view)
 		{
 			if (view == null)
 				return;
-			UnGrabbedMouse?.Invoke (view);
+			UnGrabbedMouse?.Invoke (view, new ViewEventArgs (view));
 		}
 
 		/// <summary>
@@ -1036,7 +1068,7 @@ namespace Terminal.Gui {
 				Driver.Refresh ();
 			}
 
-			NotifyNewRunState?.Invoke (rs);
+			NotifyNewRunState?.Invoke (toplevel, new RunStateEventArgs (rs));
 			return rs;
 		}
 
@@ -1504,24 +1536,10 @@ namespace Terminal.Gui {
 		static void OnNotifyStopRunState (Toplevel top)
 		{
 			if (ExitRunLoopAfterFirstIteration) {
-				NotifyStopRunState?.Invoke (top);
+				NotifyStopRunState?.Invoke (top, new ToplevelEventArgs (top));
 			}
 		}
 
-		/// <summary>
-		/// Event arguments for the <see cref="Application.Resized"/> event.
-		/// </summary>
-		public class ResizedEventArgs : EventArgs {
-			/// <summary>
-			/// The number of rows in the resized terminal.
-			/// </summary>
-			public int Rows { get; set; }
-			/// <summary>
-			/// The number of columns in the resized terminal.
-			/// </summary>
-			public int Cols { get; set; }
-		}
-
 		/// <summary>
 		/// Invoked when the terminal was resized. The new size of the terminal is provided.
 		/// </summary>
@@ -1537,7 +1555,7 @@ namespace Terminal.Gui {
 				t.SetRelativeLayout (full);
 				t.LayoutSubviews ();
 				t.PositionToplevels ();
-				t.OnResized (full.Size);
+				t.OnResized (new SizeChangedEventArgs (full.Size));
 			}
 			Refresh ();
 		}

+ 3 - 3
Terminal.Gui/Core/Autocomplete/Autocomplete.cs

@@ -74,18 +74,18 @@ namespace Terminal.Gui {
 			}
 		}
 
-		private void Top_Removed (View obj)
+		private void Top_Removed (object sender, SuperViewChangedEventArgs e)
 		{
 			Visible = false;
 			ManipulatePopup ();
 		}
 
-		private void Top_DrawContentComplete (Rect obj)
+		private void Top_DrawContentComplete (object sender, DrawEventArgs e)
 		{
 			ManipulatePopup ();
 		}
 
-		private void Top_DrawContent (Rect obj)
+		private void Top_DrawContent (object sender, DrawEventArgs e)
 		{
 			if (!closed) {
 				ReopenSuggestions ();

+ 0 - 27
Terminal.Gui/Core/Canvas.cs

@@ -1,27 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace Terminal.Gui.Core {
-	/// <summary>
-	/// The <see cref="Canvas"/> is a <see cref="Responder"/> that can be used to draw on the screen. 
-	/// It is the base class of <see cref="View"/> and <see cref="Frame"/>.
-	/// </summary>
-	public class Canvas : Responder {
-		/// <summary>
-		/// Initializes a new instance of the <see cref="Canvas"/> class.
-		/// </summary>
-		public Canvas () : this (Rect.Empty) {}
-
-		/// <summary>
-		/// Initializes a new instance of the <see cref="Canvas"/> class.
-		/// </summary>
-		/// <param name="frame">The <see cref="Rect"/> that defines the position and size of the <see cref="Canvas"/> on the screen.</param>
-		/// relative coordinates.</param>
-		public Canvas (Rect frame) 
-		{
-		}
-	}
-}

+ 3 - 22
Terminal.Gui/Core/CollectionNavigator.cs

@@ -15,7 +15,7 @@ namespace Terminal.Gui {
 	/// If the user pauses keystrokes for a short time (see <see cref="TypingDelay"/>), the search string is cleared.
 	/// </para>
 	/// </summary>
-	public class CollectionNavigator {
+	public partial class CollectionNavigator {
 		/// <summary>
 		/// Constructs a new CollectionNavigator.
 		/// </summary>
@@ -44,29 +44,10 @@ namespace Terminal.Gui {
 		/// </summary>
 		public IEnumerable<object> Collection { get; set; }
 
-		/// <summary>
-		/// Event arguments for the <see cref="CollectionNavigator.SearchStringChanged"/> event.
-		/// </summary>
-		public class KeystrokeNavigatorEventArgs {
-			/// <summary>
-			/// he current <see cref="SearchString"/>.
-			/// </summary>
-			public string SearchString { get; }
-
-			/// <summary>
-			/// Initializes a new instance of <see cref="KeystrokeNavigatorEventArgs"/>
-			/// </summary>
-			/// <param name="searchString">The current <see cref="SearchString"/>.</param>
-			public KeystrokeNavigatorEventArgs (string searchString)
-			{
-				SearchString = searchString;
-			}
-		}
-
 		/// <summary>
 		/// This event is invoked when <see cref="SearchString"/>  changes. Useful for debugging.
 		/// </summary>
-		public event Action<KeystrokeNavigatorEventArgs> SearchStringChanged;
+		public event EventHandler<KeystrokeNavigatorEventArgs> SearchStringChanged;
 
 		private string _searchString = "";
 		/// <summary>
@@ -87,7 +68,7 @@ namespace Terminal.Gui {
 		/// <param name="e"></param>
 		public virtual void OnSearchStringChanged (KeystrokeNavigatorEventArgs e)
 		{
-			SearchStringChanged?.Invoke (e);
+			SearchStringChanged?.Invoke (this, e);
 		}
 
 		/// <summary>

+ 29 - 0
Terminal.Gui/Core/GrabMouseEventArgs.cs

@@ -0,0 +1,29 @@
+using System;
+
+namespace Terminal.Gui {
+	/// <summary>
+	/// Args for events that relate to specific <see cref="Application.MouseGrabView"/>
+	/// </summary>
+	public class GrabMouseEventArgs : EventArgs {
+
+		/// <summary>
+		/// Creates a new instance of the <see cref="GrabMouseEventArgs"/> class.
+		/// </summary>
+		/// <param name="view">The view that the event is about.</param>
+		public GrabMouseEventArgs (View view)
+		{
+			View = view;
+		}
+
+		/// <summary>
+		/// The view that the event is about.
+		/// </summary>
+		public View View { get; }
+
+		/// <summary>
+		/// Flag that allows the cancellation of the event. If set to <see langword="true"/> in the
+		/// event handler, the event will be canceled.
+		/// </summary>
+		public bool Cancel { get; set; }
+	}
+}

+ 34 - 0
Terminal.Gui/Core/KeyChangedEventArgs.cs

@@ -0,0 +1,34 @@
+using System;
+
+namespace Terminal.Gui {
+
+	/// <summary>
+	/// Event args for when a <see cref="Key"/> is changed from
+	/// one value to a new value (e.g. in <see cref="View.HotKeyChanged"/>)
+	/// </summary>
+	public class KeyChangedEventArgs : EventArgs {
+
+		/// <summary>
+		/// Gets the old <see cref="Key"/> that was set before the event.
+		/// Use <see cref="Key.Null"/> to check for empty.
+		/// </summary>
+		public Key OldKey { get; }
+
+		/// <summary>
+		/// Gets the new <see cref="Key"/> that is being used.
+		/// Use <see cref="Key.Null"/> to check for empty.
+		/// </summary>
+		public Key NewKey { get; }
+
+		/// <summary>
+		/// Creates a new instance of the <see cref="KeyChangedEventArgs"/> class
+		/// </summary>
+		/// <param name="oldKey"></param>
+		/// <param name="newKey"></param>
+		public KeyChangedEventArgs (Key oldKey, Key newKey)
+		{
+			this.OldKey = oldKey;
+			this.NewKey = newKey;
+		}
+	}
+}

+ 24 - 0
Terminal.Gui/Core/KeyEventEventArgs.cs

@@ -0,0 +1,24 @@
+using System;
+
+namespace Terminal.Gui {
+
+	/// <summary>
+	/// Defines the event arguments for <see cref="KeyEvent"/>
+	/// </summary>
+	public class KeyEventEventArgs : EventArgs {
+		/// <summary>
+		/// Constructs.
+		/// </summary>
+		/// <param name="ke"></param>
+		public KeyEventEventArgs (KeyEvent ke) => KeyEvent = ke;
+		/// <summary>
+		/// The <see cref="KeyEvent"/> for the event.
+		/// </summary>
+		public KeyEvent KeyEvent { get; set; }
+		/// <summary>
+		/// Indicates if the current Key event has already been processed and the driver should stop notifying any other event subscriber.
+		/// Its important to set this value to true specially when updating any View's layout from inside the subscriber method.
+		/// </summary>
+		public bool Handled { get; set; } = false;
+	}
+}

+ 22 - 0
Terminal.Gui/Core/KeystrokeNavigatorEventArgs.cs

@@ -0,0 +1,22 @@
+using System;
+
+namespace Terminal.Gui {
+	/// <summary>
+	/// Event arguments for the <see cref="CollectionNavigator.SearchStringChanged"/> event.
+	/// </summary>
+	public class KeystrokeNavigatorEventArgs : EventArgs {
+		/// <summary>
+		/// he current <see cref="SearchString"/>.
+		/// </summary>
+		public string SearchString { get; }
+
+		/// <summary>
+		/// Initializes a new instance of <see cref="KeystrokeNavigatorEventArgs"/>
+		/// </summary>
+		/// <param name="searchString">The current <see cref="SearchString"/>.</param>
+		public KeystrokeNavigatorEventArgs (string searchString)
+		{
+			SearchString = searchString;
+		}
+	}
+}

+ 2 - 2
Terminal.Gui/Core/MainLoop.cs

@@ -97,7 +97,7 @@ namespace Terminal.Gui {
 		/// Invoked when a new timeout is added. To be used in the case
 		/// when <see cref="Application.ExitRunLoopAfterFirstIteration"/> is <see langword="true"/>.
 		/// </summary>
-		public event Action<long> TimeoutAdded;
+		public event EventHandler<TimeoutEventArgs> TimeoutAdded;
 
 		/// <summary>
 		///  Creates a new Mainloop. 
@@ -161,7 +161,7 @@ namespace Terminal.Gui {
 			lock (timeoutsLockToken) {
 				var k = (DateTime.UtcNow + time).Ticks;
 				timeouts.Add (NudgeToUniqueKey (k), timeout);
-				TimeoutAdded?.Invoke (k);
+				TimeoutAdded?.Invoke (this, new TimeoutEventArgs(timeout, k));
 			}
 		}
 

+ 31 - 0
Terminal.Gui/Core/MouseEventEventArgs.cs

@@ -0,0 +1,31 @@
+using System;
+
+namespace Terminal.Gui {
+	/// <summary>
+	/// Specifies the event arguments for <see cref="Terminal.Gui.MouseEvent"/>. This is a higher-level construct
+	/// than the wrapped <see cref="MouseEvent"/> class and is used for the events defined on <see cref="View"/>
+	/// and subclasses of View (e.g. <see cref="View.MouseEnter"/> and <see cref="View.MouseClick"/>).
+	/// </summary>
+	public class MouseEventEventArgs : EventArgs {
+		/// <summary>
+		/// Constructs.
+		/// </summary>
+		/// <param name="me">The mouse event.</param>
+		public MouseEventEventArgs (MouseEvent me) => MouseEvent = me;
+		/// <summary>
+		/// The <see cref="Terminal.Gui.MouseEvent"/> for the event.
+		/// </summary>
+		public MouseEvent MouseEvent { get; set; }
+
+		/// <summary>
+		/// Indicates if the current mouse event has already been processed and the driver should stop notifying any other event subscriber.
+		/// Its important to set this value to true specially when updating any View's layout from inside the subscriber method.
+		/// </summary>
+		/// <remarks>This property forwards to the <see cref="MouseEvent.Handled"/> property and is provided as a convenience and for
+		/// backwards compatibility</remarks>
+		public bool Handled {
+			get => MouseEvent.Handled;
+			set => MouseEvent.Handled = value;
+		}
+	}
+}

+ 30 - 0
Terminal.Gui/Core/MouseFlagsChangedEventArgs.cs

@@ -0,0 +1,30 @@
+using System;
+
+namespace Terminal.Gui {
+	/// <summary>
+	/// Args for events that describe a change in <see cref="MouseFlags"/>
+	/// </summary>
+	public class MouseFlagsChangedEventArgs : EventArgs {
+
+		/// <summary>
+		/// Creates a new instance of the <see cref="MouseFlagsChangedEventArgs"/> class.
+		/// </summary>
+		/// <param name="oldValue"></param>
+		/// <param name="newValue"></param>
+		public MouseFlagsChangedEventArgs (MouseFlags oldValue, MouseFlags newValue)
+		{
+			OldValue = oldValue;
+			NewValue = newValue;
+		}
+
+		/// <summary>
+		/// The old value before event
+		/// </summary>
+		public MouseFlags OldValue { get; }
+
+		/// <summary>
+		/// The new value
+		/// </summary>
+		public MouseFlags NewValue { get; }
+	}
+}

+ 23 - 0
Terminal.Gui/Core/PointEventArgs.cs

@@ -0,0 +1,23 @@
+using System;
+
+namespace Terminal.Gui {
+	/// <summary>
+	/// Event args for events which relate to a single <see cref="Point"/>
+	/// </summary>
+	public class PointEventArgs : EventArgs {
+
+		/// <summary>
+		/// Creates a new instance of the <see cref="PointEventArgs"/> class
+		/// </summary>
+		/// <param name="p"></param>
+		public PointEventArgs (Point p)
+		{
+			this.Point = p;
+		}
+
+		/// <summary>
+		/// The point the event happened at
+		/// </summary>
+		public Point Point { get; }
+	}
+}

+ 32 - 0
Terminal.Gui/Core/ResizedEventArgs.cs

@@ -0,0 +1,32 @@
+//
+// Core.cs: The core engine for gui.cs
+//
+// Authors:
+//   Miguel de Icaza ([email protected])
+//
+// Pending:
+//   - Check for NeedDisplay on the hierarchy and repaint
+//   - Layout support
+//   - "Colors" type or "Attributes" type?
+//   - What to surface as "BackgroundCOlor" when clearing a window, an attribute or colors?
+//
+// Optimizations
+//   - Add rendering limitation to the exposed area
+using System;
+
+namespace Terminal.Gui {
+
+	/// <summary>
+	/// Event arguments for the <see cref="Application.Resized"/> event.
+	/// </summary>
+	public class ResizedEventArgs : EventArgs {
+		/// <summary>
+		/// The number of rows in the resized terminal.
+		/// </summary>
+		public int Rows { get; set; }
+		/// <summary>
+		/// The number of columns in the resized terminal.
+		/// </summary>
+		public int Cols { get; set; }
+	}
+}

+ 24 - 0
Terminal.Gui/Core/RunStateEventArgs.cs

@@ -0,0 +1,24 @@
+using System;
+using static Terminal.Gui.Application;
+
+namespace Terminal.Gui {
+	/// <summary>
+	/// Event arguments for events about <see cref="RunState"/>
+	/// </summary>
+	public class RunStateEventArgs : EventArgs {
+
+		/// <summary>
+		/// Creates a new instance of the <see cref="RunStateEventArgs"/> class
+		/// </summary>
+		/// <param name="state"></param>
+		public RunStateEventArgs (RunState state)
+		{
+			State = state;
+		}
+
+		/// <summary>
+		/// The state being reported on by the event
+		/// </summary>
+		public RunState State { get; }
+	}
+}

+ 26 - 0
Terminal.Gui/Core/SizeChangedEventArgs.cs

@@ -0,0 +1,26 @@
+using System;
+
+namespace Terminal.Gui {
+
+	/// <summary>
+	/// Args for events about Size (e.g. Resized)
+	/// </summary>
+	public class SizeChangedEventArgs : EventArgs {
+
+		/// <summary>
+		/// Creates a new instance of the <see cref="SizeChangedEventArgs"/> class.
+		/// </summary>
+		/// <param name="size"></param>
+		public SizeChangedEventArgs (Size size)
+		{
+			Size = size;
+		}
+
+		/// <summary>
+		/// Gets the size the event describes.  This should
+		/// reflect the new/current size after the event
+		/// resolved.
+		/// </summary>
+		public Size Size { get; }
+	}
+}

+ 33 - 0
Terminal.Gui/Core/SuperViewChangedEventArgs.cs

@@ -0,0 +1,33 @@
+using System;
+
+namespace Terminal.Gui {
+	/// <summary>
+	/// Args for events where the <see cref="View.SuperView"/> of a <see cref="View"/> is changed
+	/// (e.g. <see cref="View.Removed"/> / <see cref="View.Added"/> events).
+	/// </summary>
+	public class SuperViewChangedEventArgs : EventArgs
+	{
+		/// <summary>
+		/// Creates a new instance of the <see cref="SuperViewChangedEventArgs"/> class.
+		/// </summary>
+		/// <param name="parent"></param>
+		/// <param name="child"></param>
+		public SuperViewChangedEventArgs (View parent, View child)
+		{
+			Parent = parent;
+			Child = child;
+		}
+
+		/// <summary>
+		/// The parent.  For <see cref="View.Removed"/> this is the old
+		/// parent (new parent now being null).  For <see cref="View.Added"/>
+		/// it is the new parent to whom view now belongs.
+		/// </summary>
+		public View Parent { get; }
+
+		/// <summary>
+		/// The view that is having it's <see cref="View.SuperView"/> changed
+		/// </summary>
+		public View Child { get; }
+	}
+}

+ 2 - 2
Terminal.Gui/Core/TextFormatter.cs

@@ -126,7 +126,7 @@ namespace Terminal.Gui {
 		/// <summary>
 		/// Event invoked when the <see cref="HotKey"/> is changed.
 		/// </summary>
-		public event Action<Key> HotKeyChanged;
+		public event EventHandler<KeyChangedEventArgs> HotKeyChanged;
 
 		/// <summary>
 		///   The text to be displayed. This text is never modified.
@@ -288,7 +288,7 @@ namespace Terminal.Gui {
 				if (hotKey != value) {
 					var oldKey = hotKey;
 					hotKey = value;
-					HotKeyChanged?.Invoke (oldKey);
+					HotKeyChanged?.Invoke (this, new KeyChangedEventArgs(oldKey,value));
 				}
 			}
 		}

+ 32 - 0
Terminal.Gui/Core/TimeoutEventArgs.cs

@@ -0,0 +1,32 @@
+using System;
+using static Terminal.Gui.MainLoop;
+
+namespace Terminal.Gui {
+	/// <summary>
+	/// <see cref="EventArgs"/> for timeout events (e.g. <see cref="MainLoop.TimeoutAdded"/>)
+	/// </summary>
+	public class TimeoutEventArgs : EventArgs {
+		/// <summary>
+		/// Gets the timeout callback handler
+		/// </summary>
+		public Timeout Timeout { get; }
+
+		/// <summary>
+		/// Gets the <see cref="DateTime.Ticks"/> in UTC time when the 
+		/// <see cref="Timeout"/> will next execute after.
+		/// </summary>
+		public long Ticks { get; }
+
+
+		/// <summary>
+		/// Creates a new instance of the <see cref="TimeoutEventArgs"/> class.
+		/// </summary>
+		/// <param name="timeout"></param>
+		/// <param name="ticks"></param>
+		public TimeoutEventArgs (Timeout timeout, long ticks)
+		{
+			Timeout = timeout;
+			Ticks = ticks;
+		}
+	}
+}

+ 46 - 0
Terminal.Gui/Core/TitleEventArgs.cs

@@ -0,0 +1,46 @@
+//
+// Authors:
+//   Miguel de Icaza ([email protected])
+//
+// NOTE: Window is functionally identical to FrameView with the following exceptions. 
+//  - Window is a Toplevel
+//  - FrameView Does not support padding (but should)
+//  - FrameView Does not support mouse dragging
+//  - FrameView Does not support IEnumerable
+// Any updates done here should probably be done in FrameView as well; TODO: Merge these classes
+
+using System;
+using NStack;
+
+namespace Terminal.Gui {
+	/// <summary>
+	/// Event arguments for Title change events.
+	/// </summary>
+	public class TitleEventArgs : EventArgs {
+		/// <summary>
+		/// The new Window Title.
+		/// </summary>
+		public ustring NewTitle { get; set; }
+
+		/// <summary>
+		/// The old Window Title.
+		/// </summary>
+		public ustring OldTitle { get; set; }
+
+		/// <summary>
+		/// Flag which allows canceling the Title change.
+		/// </summary>
+		public bool Cancel { get; set; }
+
+		/// <summary>
+		/// Initializes a new instance of <see cref="TitleEventArgs"/>
+		/// </summary>
+		/// <param name="oldTitle">The <see cref="Window.Title"/> that is/has been replaced.</param>
+		/// <param name="newTitle">The new <see cref="Window.Title"/> to be replaced.</param>
+		public TitleEventArgs (ustring oldTitle, ustring newTitle)
+		{
+			OldTitle = oldTitle;
+			NewTitle = newTitle;
+		}
+	}
+}

+ 30 - 0
Terminal.Gui/Core/ToggleEventArgs.cs

@@ -0,0 +1,30 @@
+using System;
+
+namespace Terminal.Gui {
+	/// <summary>
+	/// <see cref="EventArgs"/> for the <see cref="CheckBox.Toggled"/> event
+	/// </summary>
+	public class ToggleEventArgs : EventArgs {
+
+		/// <summary>
+		/// Creates a new instance of the <see cref="ToggleEventArgs"/> class.
+		/// </summary>
+		/// <param name="oldValue"></param>
+		/// <param name="newValue"></param>
+		public ToggleEventArgs (bool? oldValue, bool? newValue)
+		{
+			OldValue = oldValue;
+			NewValue = newValue;
+		}
+
+		/// <summary>
+		/// The previous checked state
+		/// </summary>
+		public bool? OldValue { get; }
+
+		/// <summary>
+		/// The new checked state
+		/// </summary>
+		public bool? NewValue { get; }
+	}
+}

+ 58 - 63
Terminal.Gui/Core/Toplevel.cs

@@ -35,7 +35,7 @@ namespace Terminal.Gui {
 		/// A Loaded event handler is a good place to finalize initialization before calling 
 		/// <see cref="Application.RunLoop(Application.RunState, bool)"/>.
 		/// </summary>
-		public event Action Loaded;
+		public event EventHandler Loaded;
 
 		/// <summary>
 		/// Invoked when the Toplevel <see cref="MainLoop"/> has started it's first iteration.
@@ -44,91 +44,91 @@ namespace Terminal.Gui {
 		/// <para>A Ready event handler is a good place to finalize initialization after calling 
 		/// <see cref="Application.Run(Func{Exception, bool})"/> on this Toplevel.</para>
 		/// </summary>
-		public event Action Ready;
+		public event EventHandler Ready;
 
 		/// <summary>
 		/// Invoked when the Toplevel <see cref="Application.RunState"/> has been unloaded.
 		/// A Unloaded event handler is a good place to dispose objects after calling <see cref="Application.End(Application.RunState)"/>.
 		/// </summary>
-		public event Action Unloaded;
+		public event EventHandler Unloaded;
 
 		/// <summary>
 		/// Invoked when the Toplevel <see cref="Application.RunState"/> becomes the <see cref="Application.Current"/> Toplevel.
 		/// </summary>
-		public event Action<Toplevel> Activate;
+		public event EventHandler<ToplevelEventArgs> Activate;
 
 		/// <summary>
 		/// Invoked when the Toplevel<see cref="Application.RunState"/> ceases to be the <see cref="Application.Current"/> Toplevel.
 		/// </summary>
-		public event Action<Toplevel> Deactivate;
+		public event EventHandler<ToplevelEventArgs> Deactivate;
 
 		/// <summary>
 		/// Invoked when a child of the Toplevel <see cref="Application.RunState"/> is closed by  
 		/// <see cref="Application.End(Application.RunState)"/>.
 		/// </summary>
-		public event Action<Toplevel> ChildClosed;
+		public event EventHandler<ToplevelEventArgs> ChildClosed;
 
 		/// <summary>
 		/// Invoked when the last child of the Toplevel <see cref="Application.RunState"/> is closed from 
 		/// by <see cref="Application.End(Application.RunState)"/>.
 		/// </summary>
-		public event Action AllChildClosed;
+		public event EventHandler AllChildClosed;
 
 		/// <summary>
 		/// Invoked when the Toplevel's <see cref="Application.RunState"/> is being closed by  
 		/// <see cref="Application.RequestStop(Toplevel)"/>.
 		/// </summary>
-		public event Action<ToplevelClosingEventArgs> Closing;
+		public event EventHandler<ToplevelClosingEventArgs> Closing;
 
 		/// <summary>
 		/// Invoked when the Toplevel's <see cref="Application.RunState"/> is closed by <see cref="Application.End(Application.RunState)"/>.
 		/// </summary>
-		public event Action<Toplevel> Closed;
+		public event EventHandler<ToplevelEventArgs> Closed;
 
 		/// <summary>
 		/// Invoked when a child Toplevel's <see cref="Application.RunState"/> has been loaded.
 		/// </summary>
-		public event Action<Toplevel> ChildLoaded;
+		public event EventHandler<ToplevelEventArgs> ChildLoaded;
 
 		/// <summary>
 		/// Invoked when a cjhild Toplevel's <see cref="Application.RunState"/> has been unloaded.
 		/// </summary>
-		public event Action<Toplevel> ChildUnloaded;
+		public event EventHandler<ToplevelEventArgs> ChildUnloaded;
 
 		/// <summary>
 		/// Invoked when the terminal has been resized. The new <see cref="Size"/> of the terminal is provided.
 		/// </summary>
-		public event Action<Size> Resized;
+		public event EventHandler<SizeChangedEventArgs> Resized;
 
-		internal virtual void OnResized (Size size)
+		internal virtual void OnResized (SizeChangedEventArgs size)
 		{
-			Resized?.Invoke (size);
+			Resized?.Invoke (this, size);
 		}
 
 		internal virtual void OnChildUnloaded (Toplevel top)
 		{
-			ChildUnloaded?.Invoke (top);
+			ChildUnloaded?.Invoke (this, new ToplevelEventArgs (top));
 		}
 
 		internal virtual void OnChildLoaded (Toplevel top)
 		{
-			ChildLoaded?.Invoke (top);
+			ChildLoaded?.Invoke (this, new ToplevelEventArgs (top));
 		}
 
 		internal virtual void OnClosed (Toplevel top)
 		{
-			Closed?.Invoke (top);
+			Closed?.Invoke (this, new ToplevelEventArgs (top));
 		}
 
 		internal virtual bool OnClosing (ToplevelClosingEventArgs ev)
 		{
-			Closing?.Invoke (ev);
+			Closing?.Invoke (this, ev);
 			return ev.Cancel;
 		}
 
 		internal virtual void OnAllChildClosed ()
 		{
-			AllChildClosed?.Invoke ();
+			AllChildClosed?.Invoke (this, EventArgs.Empty);
 		}
 
 		internal virtual void OnChildClosed (Toplevel top)
@@ -136,17 +136,17 @@ namespace Terminal.Gui {
 			if (IsMdiContainer) {
 				SetSubViewNeedsDisplay ();
 			}
-			ChildClosed?.Invoke (top);
+			ChildClosed?.Invoke (this, new ToplevelEventArgs (top));
 		}
 
 		internal virtual void OnDeactivate (Toplevel activated)
 		{
-			Deactivate?.Invoke (activated);
+			Deactivate?.Invoke (this, new ToplevelEventArgs (activated));
 		}
 
 		internal virtual void OnActivate (Toplevel deactivated)
 		{
-			Activate?.Invoke (deactivated);
+			Activate?.Invoke (this, new ToplevelEventArgs (deactivated));
 		}
 
 		/// <summary>
@@ -158,7 +158,7 @@ namespace Terminal.Gui {
 			foreach (Toplevel tl in Subviews.Where (v => v is Toplevel)) {
 				tl.OnLoaded ();
 			}
-			Loaded?.Invoke ();
+			Loaded?.Invoke (this, EventArgs.Empty);
 		}
 
 		/// <summary>
@@ -170,7 +170,7 @@ namespace Terminal.Gui {
 			foreach (Toplevel tl in Subviews.Where (v => v is Toplevel)) {
 				tl.OnReady ();
 			}
-			Ready?.Invoke ();
+			Ready?.Invoke (this, EventArgs.Empty);
 		}
 
 		/// <summary>
@@ -181,7 +181,7 @@ namespace Terminal.Gui {
 			foreach (Toplevel tl in Subviews.Where (v => v is Toplevel)) {
 				tl.OnUnloaded ();
 			}
-			Unloaded?.Invoke ();
+			Unloaded?.Invoke (this, EventArgs.Empty);
 		}
 
 		/// <summary>
@@ -208,6 +208,9 @@ namespace Terminal.Gui {
 		{
 			ColorScheme = Colors.TopLevel;
 
+			Application.GrabbingMouse += Application_GrabbingMouse;
+			Application.UnGrabbingMouse += Application_UnGrabbingMouse;
+      
 			// TODO: v2 - ALL Views (Responders??!?!) should support the commands related to 
 			//    - Focus
 			//  Move the appropriate AddCommand calls to `Responder`
@@ -247,49 +250,63 @@ namespace Terminal.Gui {
 			AddKeyBinding (Key.L | Key.CtrlMask, Command.Refresh);
 		}
 
+		private void Application_UnGrabbingMouse (object sender, GrabMouseEventArgs e)
+		{
+			if (Application.MouseGrabView == this && dragPosition.HasValue) {
+				e.Cancel = true;
+			}
+		}
+
+		private void Application_GrabbingMouse (object sender, GrabMouseEventArgs e)
+		{
+			if (Application.MouseGrabView == this && dragPosition.HasValue) {
+				e.Cancel = true;
+			}
+		}
+
 		/// <summary>
 		/// Invoked when the <see cref="Application.AlternateForwardKey"/> is changed.
 		/// </summary>
-		public event Action<Key> AlternateForwardKeyChanged;
+		public event EventHandler<KeyChangedEventArgs> AlternateForwardKeyChanged;
 
 		/// <summary>
 		/// Virtual method to invoke the <see cref="AlternateForwardKeyChanged"/> event.
 		/// </summary>
-		/// <param name="oldKey"></param>
-		public virtual void OnAlternateForwardKeyChanged (Key oldKey)
+		/// <param name="e"></param>
+		public virtual void OnAlternateForwardKeyChanged (KeyChangedEventArgs e)
 		{
-			ReplaceKeyBinding (oldKey, Application.AlternateForwardKey);
-			AlternateForwardKeyChanged?.Invoke (oldKey);
+			ReplaceKeyBinding (e.OldKey, e.NewKey);
+			AlternateForwardKeyChanged?.Invoke (this, e);
 		}
 
 		/// <summary>
 		/// Invoked when the <see cref="Application.AlternateBackwardKey"/> is changed.
 		/// </summary>
-		public event Action<Key> AlternateBackwardKeyChanged;
+		public event EventHandler<KeyChangedEventArgs> AlternateBackwardKeyChanged;
 
 		/// <summary>
 		/// Virtual method to invoke the <see cref="AlternateBackwardKeyChanged"/> event.
 		/// </summary>
-		/// <param name="oldKey"></param>
-		public virtual void OnAlternateBackwardKeyChanged (Key oldKey)
+		/// <param name="e"></param>
+		public virtual void OnAlternateBackwardKeyChanged (KeyChangedEventArgs e)
 		{
-			ReplaceKeyBinding (oldKey, Application.AlternateBackwardKey);
-			AlternateBackwardKeyChanged?.Invoke (oldKey);
+			ReplaceKeyBinding (e.OldKey, e.NewKey);
+			AlternateBackwardKeyChanged?.Invoke (this, e);
 		}
 
 		/// <summary>
 		/// Invoked when the <see cref="Application.QuitKey"/> is changed.
 		/// </summary>
-		public event Action<Key> QuitKeyChanged;
+		public event EventHandler<KeyChangedEventArgs> QuitKeyChanged;
 
 		/// <summary>
 		/// Virtual method to invoke the <see cref="QuitKeyChanged"/> event.
 		/// </summary>
-		/// <param name="oldKey"></param>
-		public virtual void OnQuitKeyChanged (Key oldKey)
+		/// <param name="e"></param>
+		public virtual void OnQuitKeyChanged (KeyChangedEventArgs e)
 		{
-			ReplaceKeyBinding (oldKey, Application.QuitKey);
-			QuitKeyChanged?.Invoke (oldKey);
+			ReplaceKeyBinding (e.OldKey, e.NewKey);
+			QuitKeyChanged?.Invoke (this, e);
 		}
 
 		/// <summary>
@@ -834,8 +851,8 @@ namespace Terminal.Gui {
 			}
 
 			if (mouseEvent.Flags.HasFlag (MouseFlags.Button1Released) && dragPosition.HasValue) {
-				Application.UngrabMouse ();
 				dragPosition = null;
+				Application.UngrabMouse ();
 			}
 
 			//System.Diagnostics.Debug.WriteLine ($"dragPosition after: {dragPosition.HasValue}");
@@ -1060,26 +1077,4 @@ namespace Terminal.Gui {
 				return string.Compare (x.Id.ToString (), y.Id.ToString ());
 		}
 	}
-	/// <summary>
-	/// <see cref="EventArgs"/> implementation for the <see cref="Toplevel.Closing"/> event.
-	/// </summary>
-	public class ToplevelClosingEventArgs : EventArgs {
-		/// <summary>
-		/// The toplevel requesting stop.
-		/// </summary>
-		public View RequestingTop { get; }
-		/// <summary>
-		/// Provides an event cancellation option.
-		/// </summary>
-		public bool Cancel { get; set; }
-
-		/// <summary>
-		/// Initializes the event arguments with the requesting toplevel.
-		/// </summary>
-		/// <param name="requestingTop">The <see cref="RequestingTop"/>.</param>
-		public ToplevelClosingEventArgs (Toplevel requestingTop)
-		{
-			RequestingTop = requestingTop;
-		}
-	}
 }

+ 51 - 0
Terminal.Gui/Core/ToplevelEventArgs.cs

@@ -0,0 +1,51 @@
+using System;
+
+namespace Terminal.Gui {
+	/// <summary>
+	/// Args for events that relate to a specific <see cref="Toplevel"/>.
+	/// </summary>
+	public class ToplevelEventArgs : EventArgs {
+
+		/// <summary>
+		/// Creates a new instance of the <see cref="ToplevelClosingEventArgs"/> class.
+		/// </summary>
+		/// <param name="toplevel"></param>
+		public ToplevelEventArgs (Toplevel toplevel)
+		{
+			Toplevel = toplevel;
+		}
+
+		/// <summary>
+		/// Gets the <see cref="Toplevel"/> that the event is about.
+		/// </summary>
+		/// <remarks>This is usually but may not always be the same as the sender 
+		/// in <see cref="EventHandler"/>.  For example if the reported event
+		/// is about a different  <see cref="Toplevel"/> or the event is
+		/// raised by a separate class.
+		/// </remarks>
+		public Toplevel Toplevel { get; }
+	}
+
+	/// <summary>
+	/// <see cref="EventArgs"/> implementation for the <see cref="Toplevel.Closing"/> event.
+	/// </summary>
+	public class ToplevelClosingEventArgs : EventArgs {
+		/// <summary>
+		/// The toplevel requesting stop.
+		/// </summary>
+		public View RequestingTop { get; }
+		/// <summary>
+		/// Provides an event cancellation option.
+		/// </summary>
+		public bool Cancel { get; set; }
+
+		/// <summary>
+		/// Initializes the event arguments with the requesting toplevel.
+		/// </summary>
+		/// <param name="requestingTop">The <see cref="RequestingTop"/>.</param>
+		public ToplevelClosingEventArgs (Toplevel requestingTop)
+		{
+			RequestingTop = requestingTop;
+		}
+	}
+}

+ 64 - 137
Terminal.Gui/Core/View.cs

@@ -116,7 +116,7 @@ namespace Terminal.Gui {
 	///     instead of on every run.
 	///   </para>
 	/// </remarks>
-	public class View : Responder, ISupportInitializeNotification {
+	public partial class View : Responder, ISupportInitializeNotification {
 
 		internal enum Direction {
 			Forward,
@@ -132,59 +132,59 @@ namespace Terminal.Gui {
 		ShortcutHelper shortcutHelper;
 
 		/// <summary>
-		/// Event fired when a subview is being added to this view.
+		/// Event fired when this view is added to another.
 		/// </summary>
-		public event Action<View> Added;
+		public event EventHandler<SuperViewChangedEventArgs> Added;
 
 		/// <summary>
-		/// Event fired when a subview is being removed from this view.
+		/// Event fired when this view is removed from another.
 		/// </summary>
-		public event Action<View> Removed;
+		public event EventHandler<SuperViewChangedEventArgs> Removed;
 
 		/// <summary>
 		/// Event fired when the view gets focus.
 		/// </summary>
-		public event Action<FocusEventArgs> Enter;
+		public event EventHandler<FocusEventArgs> Enter;
 
 		/// <summary>
 		/// Event fired when the view looses focus.
 		/// </summary>
-		public event Action<FocusEventArgs> Leave;
+		public event EventHandler<FocusEventArgs> Leave;
 
 		/// <summary>
 		/// Event fired when the view receives the mouse event for the first time.
 		/// </summary>
-		public event Action<MouseEventArgs> MouseEnter;
+		public event EventHandler<MouseEventEventArgs> MouseEnter;
 
 		/// <summary>
 		/// Event fired when the view receives a mouse event for the last time.
 		/// </summary>
-		public event Action<MouseEventArgs> MouseLeave;
+		public event EventHandler<MouseEventEventArgs> MouseLeave;
 
 		/// <summary>
 		/// Event fired when a mouse event is generated.
 		/// </summary>
-		public event Action<MouseEventArgs> MouseClick;
+		public event EventHandler<MouseEventEventArgs> MouseClick;
 
 		/// <summary>
 		/// Event fired when the <see cref="CanFocus"/> value is being changed.
 		/// </summary>
-		public event Action CanFocusChanged;
+		public event EventHandler CanFocusChanged;
 
 		/// <summary>
 		/// Event fired when the <see cref="Enabled"/> value is being changed.
 		/// </summary>
-		public event Action EnabledChanged;
+		public event EventHandler EnabledChanged;
 
 		/// <summary>
 		/// Event fired when the <see cref="Visible"/> value is being changed.
 		/// </summary>
-		public event Action VisibleChanged;
+		public event EventHandler VisibleChanged;
 
 		/// <summary>
 		/// Event invoked when the <see cref="HotKey"/> is changed.
 		/// </summary>
-		public event Action<Key> HotKeyChanged;
+		public event EventHandler<KeyChangedEventArgs> HotKeyChanged;
 
 		Key hotKey = Key.Null;
 
@@ -1018,9 +1018,9 @@ namespace Terminal.Gui {
 			SetNeedsDisplay ();
 		}
 
-		void TextFormatter_HotKeyChanged (Key obj)
+		void TextFormatter_HotKeyChanged (object sender, KeyChangedEventArgs e)
 		{
-			HotKeyChanged?.Invoke (obj);
+			HotKeyChanged?.Invoke (this, e);
 		}
 
 		internal bool LayoutNeeded { get; private set; } = true;
@@ -1151,7 +1151,8 @@ namespace Terminal.Gui {
 			}
 			SetNeedsLayout ();
 			SetNeedsDisplay ();
-			OnAdded (view);
+      
+			OnAdded (new SuperViewChangedEventArgs (this, view));
 			if (IsInitialized && !view.IsInitialized) {
 				view.BeginInit ();
 				view.EndInit ();
@@ -1213,8 +1214,10 @@ namespace Terminal.Gui {
 				if (v.Frame.IntersectsWith (touched))
 					view.SetNeedsDisplay ();
 			}
-			OnRemoved (view);
-			if (focused == view) focused = null;
+			OnRemoved (new SuperViewChangedEventArgs (this, view));
+			if (focused == view) {
+				focused = null;
+			}
 		}
 
 		void PerformActionForSubview (View subview, Action<View> action)
@@ -1590,56 +1593,38 @@ namespace Terminal.Gui {
 			}
 		}
 
-		/// <summary>
-		/// Defines the event arguments for <see cref="SetFocus(View)"/>
-		/// </summary>
-		public class FocusEventArgs : EventArgs {
-			/// <summary>
-			/// Constructs.
-			/// </summary>
-			/// <param name="view">The view that gets or loses focus.</param>
-			public FocusEventArgs (View view) { View = view; }
-			/// <summary>
-			/// Indicates if the current focus event has already been processed and the driver should stop notifying any other event subscriber.
-			/// Its important to set this value to true specially when updating any View's layout from inside the subscriber method.
-			/// </summary>
-			public bool Handled { get; set; }
-			/// <summary>
-			/// Indicates the current view that gets or loses focus.
-			/// </summary>
-			public View View { get; set; }
-		}
-
 		/// <summary>
 		/// Method invoked when a subview is being added to this view.
 		/// </summary>
-		/// <param name="view">The subview being added.</param>
-		public virtual void OnAdded (View view)
+		/// <param name="e">Event where <see cref="ViewEventArgs.View"/> is the subview being added.</param>
+		public virtual void OnAdded (SuperViewChangedEventArgs e)
 		{
+			var view = e.Child;
 			view.IsAdded = true;
 			view.x ??= view.frame.X;
 			view.y ??= view.frame.Y;
 			view.width ??= view.frame.Width;
 			view.height ??= view.frame.Height;
 
-			view.Added?.Invoke (this);
+			view.Added?.Invoke (this, e);
 		}
 
 		/// <summary>
 		/// Method invoked when a subview is being removed from this view.
 		/// </summary>
-		/// <param name="view">The subview being removed.</param>
-		public virtual void OnRemoved (View view)
+		/// <param name="e">Event args describing the subview being removed.</param>
+		public virtual void OnRemoved (SuperViewChangedEventArgs e)
 		{
+			var view = e.Child;
 			view.IsAdded = false;
-			view.Removed?.Invoke (this);
+			view.Removed?.Invoke (this, e);
 		}
 
 		/// <inheritdoc/>
 		public override bool OnEnter (View view)
 		{
 			var args = new FocusEventArgs (view);
-			Enter?.Invoke (args);
+			Enter?.Invoke (this, args);
 			if (args.Handled)
 				return true;
 			if (base.OnEnter (view))
@@ -1652,7 +1637,7 @@ namespace Terminal.Gui {
 		public override bool OnLeave (View view)
 		{
 			var args = new FocusEventArgs (view);
-			Leave?.Invoke (args);
+			Leave?.Invoke (this, args);
 			if (args.Handled)
 				return true;
 			if (base.OnLeave (view))
@@ -1830,20 +1815,20 @@ namespace Terminal.Gui {
 		/// Rect provides the view-relative rectangle describing the currently visible viewport into the <see cref="View"/>.
 		/// </para>
 		/// </remarks>
-		public event Action<Rect> DrawContent;
+		public event EventHandler<DrawEventArgs> DrawContent;
 
 		/// <summary>
 		/// Enables overrides to draw infinitely scrolled content and/or a background behind added controls. 
 		/// </summary>
-		/// <param name="viewport">The view-relative rectangle describing the currently visible viewport into the <see cref="View"/></param>
+		/// <param name="contentArea">The view-relative rectangle describing the currently visible viewport into the <see cref="View"/></param>
 		/// <remarks>
 		/// This method will be called before any subviews added with <see cref="Add(View)"/> have been drawn. 
 		/// </remarks>
 		public virtual void OnDrawContent (Rect contentArea)
 		{
 			// TODO: Make DrawContent a cancelable event
-			// if (!DrawContent?.Invoke(viewport)) {
-			DrawContent?.Invoke (contentArea);
+			// if (!DrawContent?.Invoke(this, new DrawEventArgs (viewport)) {
+			DrawContent?.Invoke (this, new DrawEventArgs (contentArea));
 
 			if (!ustring.IsNullOrEmpty (TextFormatter.Text)) {
 				if (TextFormatter != null) {
@@ -1867,7 +1852,7 @@ namespace Terminal.Gui {
 		/// Rect provides the view-relative rectangle describing the currently visible viewport into the <see cref="View"/>.
 		/// </para>
 		/// </remarks>
-		public event Action<Rect> DrawContentComplete;
+		public event EventHandler<DrawEventArgs> DrawContentComplete;
 
 		/// <summary>
 		/// Enables overrides after completed drawing infinitely scrolled content and/or a background behind removed controls.
@@ -1878,7 +1863,7 @@ namespace Terminal.Gui {
 		/// </remarks>
 		public virtual void OnDrawContentComplete (Rect viewport)
 		{
-			DrawContentComplete?.Invoke (viewport);
+			DrawContentComplete?.Invoke (this, new DrawEventArgs (viewport));
 		}
 
 		/// <summary>
@@ -1930,30 +1915,10 @@ namespace Terminal.Gui {
 			SuperView?.SetFocus (this);
 		}
 
-		/// <summary>
-		/// Defines the event arguments for <see cref="KeyEvent"/>
-		/// </summary>
-		public class KeyEventEventArgs : EventArgs {
-			/// <summary>
-			/// Constructs.
-			/// </summary>
-			/// <param name="ke"></param>
-			public KeyEventEventArgs (KeyEvent ke) => KeyEvent = ke;
-			/// <summary>
-			/// The <see cref="KeyEvent"/> for the event.
-			/// </summary>
-			public KeyEvent KeyEvent { get; set; }
-			/// <summary>
-			/// Indicates if the current Key event has already been processed and the driver should stop notifying any other event subscriber.
-			/// Its important to set this value to true specially when updating any View's layout from inside the subscriber method.
-			/// </summary>
-			public bool Handled { get; set; } = false;
-		}
-
 		/// <summary>
 		/// Invoked when a character key is pressed and occurs after the key up event.
 		/// </summary>
-		public event Action<KeyEventEventArgs> KeyPress;
+		public event EventHandler<KeyEventEventArgs> KeyPress;
 
 		/// <inheritdoc/>
 		public override bool ProcessKey (KeyEvent keyEvent)
@@ -1963,11 +1928,11 @@ namespace Terminal.Gui {
 			}
 
 			var args = new KeyEventEventArgs (keyEvent);
-			KeyPress?.Invoke (args);
+			KeyPress?.Invoke (this, args);
 			if (args.Handled)
 				return true;
 			if (Focused?.Enabled == true) {
-				Focused?.KeyPress?.Invoke (args);
+				Focused?.KeyPress?.Invoke (this, args);
 				if (args.Handled)
 					return true;
 			}
@@ -2139,7 +2104,7 @@ namespace Terminal.Gui {
 
 			var args = new KeyEventEventArgs (keyEvent);
 			if (MostFocused?.Enabled == true) {
-				MostFocused?.KeyPress?.Invoke (args);
+				MostFocused?.KeyPress?.Invoke (this, args);
 				if (args.Handled)
 					return true;
 			}
@@ -2162,11 +2127,11 @@ namespace Terminal.Gui {
 			}
 
 			var args = new KeyEventEventArgs (keyEvent);
-			KeyPress?.Invoke (args);
+			KeyPress?.Invoke (this, args);
 			if (args.Handled)
 				return true;
 			if (MostFocused?.Enabled == true) {
-				MostFocused?.KeyPress?.Invoke (args);
+				MostFocused?.KeyPress?.Invoke (this, args);
 				if (args.Handled)
 					return true;
 			}
@@ -2184,7 +2149,7 @@ namespace Terminal.Gui {
 		/// <summary>
 		/// Invoked when a key is pressed.
 		/// </summary>
-		public event Action<KeyEventEventArgs> KeyDown;
+		public event EventHandler<KeyEventEventArgs> KeyDown;
 
 		/// <inheritdoc/>
 		public override bool OnKeyDown (KeyEvent keyEvent)
@@ -2194,12 +2159,12 @@ namespace Terminal.Gui {
 			}
 
 			var args = new KeyEventEventArgs (keyEvent);
-			KeyDown?.Invoke (args);
+			KeyDown?.Invoke (this, args);
 			if (args.Handled) {
 				return true;
 			}
 			if (Focused?.Enabled == true) {
-				Focused.KeyDown?.Invoke (args);
+				Focused.KeyDown?.Invoke (this, args);
 				if (args.Handled) {
 					return true;
 				}
@@ -2214,7 +2179,7 @@ namespace Terminal.Gui {
 		/// <summary>
 		/// Invoked when a key is released.
 		/// </summary>
-		public event Action<KeyEventEventArgs> KeyUp;
+		public event EventHandler<KeyEventEventArgs> KeyUp;
 
 		/// <inheritdoc/>
 		public override bool OnKeyUp (KeyEvent keyEvent)
@@ -2224,12 +2189,12 @@ namespace Terminal.Gui {
 			}
 
 			var args = new KeyEventEventArgs (keyEvent);
-			KeyUp?.Invoke (args);
+			KeyUp?.Invoke (this, args);
 			if (args.Handled) {
 				return true;
 			}
 			if (Focused?.Enabled == true) {
-				Focused.KeyUp?.Invoke (args);
+				Focused.KeyUp?.Invoke (this, args);
 				if (args.Handled) {
 					return true;
 				}
@@ -2520,30 +2485,20 @@ namespace Terminal.Gui {
 			}
 		}
 
-		/// <summary>
-		/// Event arguments for the <see cref="LayoutComplete"/> event.
-		/// </summary>
-		public class LayoutEventArgs : EventArgs {
-			/// <summary>
-			/// The view-relative bounds of the <see cref="View"/> before it was laid out.
-			/// </summary>
-			public Rect OldBounds { get; set; }
-		}
-
 		/// <summary>
 		/// Fired after the View's <see cref="LayoutSubviews"/> method has completed. 
 		/// </summary>
 		/// <remarks>
 		/// Subscribe to this event to perform tasks when the <see cref="View"/> has been resized or the layout has otherwise changed.
 		/// </remarks>
-		public event Action<LayoutEventArgs> LayoutStarted;
+		public event EventHandler<LayoutEventArgs> LayoutStarted;
 
 		/// <summary>
 		/// Raises the <see cref="LayoutStarted"/> event. Called from  <see cref="LayoutSubviews"/> before any subviews have been laid out.
 		/// </summary>
 		internal virtual void OnLayoutStarted (LayoutEventArgs args)
 		{
-			LayoutStarted?.Invoke (args);
+			LayoutStarted?.Invoke (this, args);
 		}
 
 		/// <summary>
@@ -2552,7 +2507,7 @@ namespace Terminal.Gui {
 		/// <remarks>
 		/// Subscribe to this event to perform tasks when the <see cref="View"/> has been resized or the layout has otherwise changed.
 		/// </remarks>
-		public event Action<LayoutEventArgs> LayoutComplete;
+		public event EventHandler<LayoutEventArgs> LayoutComplete;
 
 		/// <summary>
 		/// Event called only once when the <see cref="View"/> is being initialized for the first time.
@@ -2566,7 +2521,7 @@ namespace Terminal.Gui {
 		/// </summary>
 		internal virtual void OnLayoutComplete (LayoutEventArgs args)
 		{
-			LayoutComplete?.Invoke (args);
+			LayoutComplete?.Invoke (this, args);
 		}
 
 		internal void CollectPos (Pos pos, View from, ref HashSet<View> nNodes, ref HashSet<(View, View)> nEdges)
@@ -3120,34 +3075,6 @@ namespace Terminal.Gui {
 			    frame.Size.Height + GetHotKeySpecifierLength (false));
 		}
 
-		/// <summary>
-		/// Specifies the event arguments for <see cref="MouseEvent"/>. This is a higher-level construct
-		/// than the wrapped <see cref="MouseEvent"/> class and is used for the events defined on <see cref="View"/>
-		/// and subclasses of View (e.g. <see cref="View.MouseEnter"/> and <see cref="View.MouseClick"/>).
-		/// </summary>
-		public class MouseEventArgs : EventArgs {
-			/// <summary>
-			/// Constructs.
-			/// </summary>
-			/// <param name="me"></param>
-			public MouseEventArgs (MouseEvent me) => MouseEvent = me;
-			/// <summary>
-			/// The <see cref="MouseEvent"/> for the event.
-			/// </summary>
-			public MouseEvent MouseEvent { get; set; }
-
-			/// <summary>
-			/// Indicates if the current mouse event has already been processed and the driver should stop notifying any other event subscriber.
-			/// Its important to set this value to true specially when updating any View's layout from inside the subscriber method.
-			/// </summary>
-			/// <remarks>This property forwards to the <see cref="MouseEvent.Handled"/> property and is provided as a convenience and for
-			/// backwards compatibility</remarks>
-			public bool Handled {
-				get => MouseEvent.Handled;
-				set => MouseEvent.Handled = value;
-			}
-		}
-
 		/// <inheritdoc/>
 		public override bool OnMouseEnter (MouseEvent mouseEvent)
 		{
@@ -3159,8 +3086,8 @@ namespace Terminal.Gui {
 				return false;
 			}
 
-			var args = new MouseEventArgs (mouseEvent);
-			MouseEnter?.Invoke (args);
+			var args = new MouseEventEventArgs (mouseEvent);
+			MouseEnter?.Invoke (this, args);
 
 			return args.Handled || base.OnMouseEnter (mouseEvent);
 		}
@@ -3176,8 +3103,8 @@ namespace Terminal.Gui {
 				return false;
 			}
 
-			var args = new MouseEventArgs (mouseEvent);
-			MouseLeave?.Invoke (args);
+			var args = new MouseEventEventArgs (mouseEvent);
+			MouseLeave?.Invoke (this, args);
 
 			return args.Handled || base.OnMouseLeave (mouseEvent);
 		}
@@ -3197,7 +3124,7 @@ namespace Terminal.Gui {
 				return false;
 			}
 
-			var args = new MouseEventArgs (mouseEvent);
+			var args = new MouseEventEventArgs (mouseEvent);
 			if (OnMouseClick (args))
 				return true;
 			if (MouseEvent (mouseEvent))
@@ -3217,24 +3144,24 @@ namespace Terminal.Gui {
 		/// <summary>
 		/// Invokes the MouseClick event.
 		/// </summary>
-		protected bool OnMouseClick (MouseEventArgs args)
+		protected bool OnMouseClick (MouseEventEventArgs args)
 		{
 			if (!Enabled) {
 				return true;
 			}
 
-			MouseClick?.Invoke (args);
+			MouseClick?.Invoke (this, args);
 			return args.Handled;
 		}
 
 		/// <inheritdoc/>
-		public override void OnCanFocusChanged () => CanFocusChanged?.Invoke ();
+		public override void OnCanFocusChanged () => CanFocusChanged?.Invoke (this, EventArgs.Empty);
 
 		/// <inheritdoc/>
-		public override void OnEnabledChanged () => EnabledChanged?.Invoke ();
+		public override void OnEnabledChanged () => EnabledChanged?.Invoke (this, EventArgs.Empty);
 
 		/// <inheritdoc/>
-		public override void OnVisibleChanged () => VisibleChanged?.Invoke ();
+		public override void OnVisibleChanged () => VisibleChanged?.Invoke (this, EventArgs.Empty);
 
 		/// <inheritdoc/>
 		protected override void Dispose (bool disposing)

+ 80 - 0
Terminal.Gui/Core/ViewEventArgs.cs

@@ -0,0 +1,80 @@
+using System;
+
+namespace Terminal.Gui {
+	/// <summary>
+	/// Args for events that relate to specific <see cref="View"/>
+	/// </summary>
+	public class ViewEventArgs : EventArgs {
+
+		/// <summary>
+		/// Creates a new instance of the <see cref="Terminal.Gui.View"/> class.
+		/// </summary>
+		/// <param name="view"></param>
+		public ViewEventArgs (View view)
+		{
+			View = view;
+		}
+
+		/// <summary>
+		/// The view that the event is about.
+		/// </summary>
+		/// <remarks>
+		/// Can be different from the sender of the <see cref="EventHandler"/>
+		/// for example if event describes the adding a child then sender may
+		/// be the parent while <see cref="View"/> is the child
+		/// being added.
+		/// </remarks>
+		public View View { get; }
+	}
+
+	/// <summary>
+	/// Event arguments for the <see cref="View.LayoutComplete"/> event.
+	/// </summary>
+	public class LayoutEventArgs : EventArgs {
+		/// <summary>
+		/// The view-relative bounds of the <see cref="View"/> before it was laid out.
+		/// </summary>
+		public Rect OldBounds { get; set; }
+	}
+
+	/// <summary>
+	/// Event args for draw events
+	/// </summary>
+	public class DrawEventArgs : EventArgs {
+
+		/// <summary>
+		/// Creates a new instance of the <see cref="DrawEventArgs"/> class.
+		/// </summary>
+		/// <param name="rect">Gets the view-relative rectangle describing the currently visible viewport into the <see cref="View"/>.</param>
+		public DrawEventArgs (Rect rect)
+		{
+			Rect = rect;
+		}
+
+		/// <summary>
+		/// Gets the view-relative rectangle describing the currently visible viewport into the <see cref="View"/>.
+		/// </summary>
+		public Rect Rect { get; }
+	}
+
+	/// <summary>
+	/// Defines the event arguments for <see cref="View.SetFocus(View)"/>
+	/// </summary>
+	public class FocusEventArgs : EventArgs {
+		/// <summary>
+		/// Constructs.
+		/// </summary>
+		/// <param name="view">The view that gets or loses focus.</param>
+		public FocusEventArgs (View view) { View = view; }
+		/// <summary>
+		/// Indicates if the current focus event has already been processed and the driver should stop notifying any other event subscriber.
+		/// Its important to set this value to true specially when updating any View's layout from inside the subscriber method.
+		/// </summary>
+		public bool Handled { get; set; }
+		/// <summary>
+		/// Indicates the current view that gets or loses focus.
+		/// </summary>
+		public View View { get; set; }
+	}
+
+}

+ 5 - 22
Terminal.Gui/Core/Window.cs

@@ -1,15 +1,4 @@
-//
-// Authors:
-//   Miguel de Icaza ([email protected])
-//
-// NOTE: Window is functionally identical to FrameView with the following exceptions. 
-//  - Window is a Toplevel
-//  - FrameView Does not support padding (but should)
-//  - FrameView Does not support mouse dragging
-//  - FrameView Does not support IEnumerable
-// Any updates done here should probably be done in FrameView as well; TODO: Merge these classes
-
-using System;
+using System;
 using System.Collections;
 using System.Text.Json.Serialization;
 using NStack;
@@ -129,12 +118,6 @@ namespace Terminal.Gui {
 			Frame = frame;
 		}
 
-		public override void BeginInit ()
-		{
-			base.BeginInit ();
-
-		}
-
 		/// <inheritdoc/>
 		public override void Add (View view)
 		{
@@ -198,7 +181,7 @@ namespace Terminal.Gui {
 		public virtual bool OnTitleChanging (ustring oldTitle, ustring newTitle)
 		{
 			var args = new TitleEventArgs (oldTitle, newTitle);
-			TitleChanging?.Invoke (args);
+			TitleChanging?.Invoke (this, args);
 			return args.Cancel;
 		}
 
@@ -206,7 +189,7 @@ namespace Terminal.Gui {
 		/// Event fired when the <see cref="View.Title"/> is changing. Set <see cref="TitleEventArgs.Cancel"/> to 
 		/// `true` to cancel the Title change.
 		/// </summary>
-		public event Action<TitleEventArgs> TitleChanging;
+		public event EventHandler<TitleEventArgs> TitleChanging;
 
 		/// <summary>
 		/// Called when the <see cref="View.Title"/> has been changed. Invokes the <see cref="TitleChanged"/> event.
@@ -216,12 +199,12 @@ namespace Terminal.Gui {
 		public virtual void OnTitleChanged (ustring oldTitle, ustring newTitle)
 		{
 			var args = new TitleEventArgs (oldTitle, newTitle);
-			TitleChanged?.Invoke (args);
+			TitleChanged?.Invoke (this, args);
 		}
 
 		/// <summary>
 		/// Event fired after the <see cref="View.Title"/> has been changed. 
 		/// </summary>
-		public event Action<TitleEventArgs> TitleChanged;
+		public event EventHandler<TitleEventArgs> TitleChanged;
 	}
 }

+ 2 - 2
Terminal.Gui/Views/Button.cs

@@ -236,7 +236,7 @@ namespace Terminal.Gui {
 		/// </summary>
 		public virtual void OnClicked ()
 		{
-			Clicked?.Invoke ();
+			Clicked?.Invoke (this, EventArgs.Empty);
 		}
 
 		/// <summary>
@@ -248,7 +248,7 @@ namespace Terminal.Gui {
 		///   raised when the button is activated either with
 		///   the mouse or the keyboard.
 		/// </remarks>
-		public event Action Clicked;
+		public event EventHandler Clicked;
 
 		///<inheritdoc/>
 		public override bool MouseEvent (MouseEvent me)

+ 43 - 0
Terminal.Gui/Views/CellActivatedEventArgs.cs

@@ -0,0 +1,43 @@
+using System;
+using System.Data;
+
+namespace Terminal.Gui {
+
+
+	/// <summary>
+	///  Defines the event arguments for <see cref="TableView.CellActivated"/> event
+	/// </summary>
+	public class CellActivatedEventArgs : EventArgs {
+		/// <summary>
+		/// The current table to which the new indexes refer.  May be null e.g. if selection change is the result of clearing the table from the view
+		/// </summary>
+		/// <value></value>
+		public DataTable Table { get; }
+
+
+		/// <summary>
+		/// The column index of the <see cref="Table"/> cell that is being activated
+		/// </summary>
+		/// <value></value>
+		public int Col { get; }
+
+		/// <summary>
+		/// The row index of the <see cref="Table"/> cell that is being activated
+		/// </summary>
+		/// <value></value>
+		public int Row { get; }
+
+		/// <summary>
+		/// Creates a new instance of arguments describing a cell being activated in <see cref="TableView"/>
+		/// </summary>
+		/// <param name="t"></param>
+		/// <param name="col"></param>
+		/// <param name="row"></param>
+		public CellActivatedEventArgs (DataTable t, int col, int row)
+		{
+			Table = t;
+			Col = col;
+			Row = row;
+		}
+	}
+}

+ 5 - 4
Terminal.Gui/Views/CheckBox.cs

@@ -27,14 +27,14 @@ namespace Terminal.Gui {
 		///   raised when the <see cref="CheckBox"/> is activated either with
 		///   the mouse or the keyboard. The passed <c>bool</c> contains the previous state. 
 		/// </remarks>
-		public event Action<bool?> Toggled;
+		public event EventHandler<ToggleEventArgs> Toggled;
 
 		/// <summary>
 		/// Called when the <see cref="Checked"/> property changes. Invokes the <see cref="Toggled"/> event.
 		/// </summary>
-		public virtual void OnToggled (bool? previousChecked)
+		public virtual void OnToggled (ToggleEventArgs e)
 		{
-			Toggled?.Invoke (previousChecked);
+			Toggled?.Invoke (this, e);
 		}
 
 		/// <summary>
@@ -209,7 +209,8 @@ namespace Terminal.Gui {
 			} else {
 				Checked = !Checked;
 			}
-			OnToggled (previousChecked);
+			
+			OnToggled (new ToggleEventArgs (previousChecked, Checked));
 			SetNeedsDisplay ();
 			return true;
 		}

+ 2 - 2
Terminal.Gui/Views/ColorPicker.cs

@@ -51,7 +51,7 @@ namespace Terminal.Gui {
 		/// <summary>
 		/// Fired when a color is picked.
 		/// </summary>
-		public event Action ColorChanged;
+		public event EventHandler ColorChanged;
 
 		private int selectColorIndex = (int)Color.Black;
 
@@ -65,7 +65,7 @@ namespace Terminal.Gui {
 
 			set {
 				selectColorIndex = (int)value;
-				ColorChanged?.Invoke ();
+				ColorChanged?.Invoke (this, EventArgs.Empty);
 				SetNeedsDisplay ();
 			}
 		}

+ 18 - 18
Terminal.Gui/Views/ComboBox.cs

@@ -188,7 +188,7 @@ namespace Terminal.Gui {
 				if (SuperView != null && SuperView.Subviews.Contains (this)) {
 					SelectedItem = -1;
 					search.Text = "";
-					Search_Changed ("");
+					Search_Changed (this, new TextChangedEventArgs(""));
 					SetNeedsDisplay ();
 				}
 			}
@@ -214,22 +214,22 @@ namespace Terminal.Gui {
 		/// <summary>
 		/// This event is raised when the selected item in the <see cref="ComboBox"/> has changed.
 		/// </summary>
-		public event Action<ListViewItemEventArgs> SelectedItemChanged;
+		public event EventHandler<ListViewItemEventArgs> SelectedItemChanged;
 
 		/// <summary>
 		/// This event is raised when the drop-down list is expanded.
 		/// </summary>
-		public event Action Expanded;
+		public event EventHandler Expanded;
 
 		/// <summary>
 		/// This event is raised when the drop-down list is collapsed.
 		/// </summary>
-		public event Action Collapsed;
+		public event EventHandler Collapsed;
 
 		/// <summary>
 		/// This event is raised when the user Double Clicks on an item or presses ENTER to open the selected item.
 		/// </summary>
-		public event Action<ListViewItemEventArgs> OpenSelectedItem;
+		public event EventHandler<ListViewItemEventArgs> OpenSelectedItem;
 
 		readonly IList searchset = new List<object> ();
 		ustring text = "";
@@ -294,12 +294,12 @@ namespace Terminal.Gui {
 			search.TextChanged += Search_Changed;
 
 			listview.Y = Pos.Bottom (search);
-			listview.OpenSelectedItem += (ListViewItemEventArgs a) => Selected ();
+			listview.OpenSelectedItem += (object sender, ListViewItemEventArgs a) => Selected ();
 
 			this.Add (search, listview);
 
 			// On resize
-			LayoutComplete += (LayoutEventArgs a) => {
+			LayoutComplete += (object sender, LayoutEventArgs a) => {
 				if ((!autoHide && Bounds.Width > 0 && search.Frame.Width != Bounds.Width) ||
 					(autoHide && Bounds.Width > 0 && search.Frame.Width != Bounds.Width - 1)) {
 					search.Width = listview.Width = autoHide ? Bounds.Width - 1 : Bounds.Width;
@@ -309,14 +309,14 @@ namespace Terminal.Gui {
 				}
 			};
 
-			listview.SelectedItemChanged += (ListViewItemEventArgs e) => {
+			listview.SelectedItemChanged += (object sender, ListViewItemEventArgs e) => {
 
 				if (!HideDropdownListOnClick && searchset.Count > 0) {
 					SetValue (searchset [listview.SelectedItem]);
 				}
 			};
 
-			Added += (View v) => {
+			Added += (s,  e) => {
 
 				// Determine if this view is hosted inside a dialog and is the only control
 				for (View view = this.SuperView; view != null; view = view.SuperView) {
@@ -328,7 +328,7 @@ namespace Terminal.Gui {
 
 				SetNeedsLayout ();
 				SetNeedsDisplay ();
-				Search_Changed (Text);
+				Search_Changed (this, new TextChangedEventArgs( Text));
 			};
 
 			// Things this view knows how to do
@@ -466,7 +466,7 @@ namespace Terminal.Gui {
 		/// </summary>
 		public virtual void OnExpanded ()
 		{
-			Expanded?.Invoke ();
+			Expanded?.Invoke (this, EventArgs.Empty);
 		}
 
 		/// <summary>
@@ -474,7 +474,7 @@ namespace Terminal.Gui {
 		/// </summary>
 		public virtual void OnCollapsed ()
 		{
-			Collapsed?.Invoke ();
+			Collapsed?.Invoke (this, EventArgs.Empty);
 		}
 
 		///<inheritdoc/>
@@ -515,7 +515,7 @@ namespace Terminal.Gui {
 		{
 			// Note: Cannot rely on "listview.SelectedItem != lastSelectedItem" because the list is dynamic. 
 			// So we cannot optimize. Ie: Don't call if not changed
-			SelectedItemChanged?.Invoke (new ListViewItemEventArgs (SelectedItem, search.Text));
+			SelectedItemChanged?.Invoke (this, new ListViewItemEventArgs (SelectedItem, search.Text));
 
 			return true;
 		}
@@ -528,7 +528,7 @@ namespace Terminal.Gui {
 		{
 			var value = search.Text;
 			lastSelectedItem = SelectedItem;
-			OpenSelectedItem?.Invoke (new ListViewItemEventArgs (SelectedItem, value));
+			OpenSelectedItem?.Invoke (this, new ListViewItemEventArgs (SelectedItem, value));
 
 			return true;
 		}
@@ -750,7 +750,7 @@ namespace Terminal.Gui {
 
 			SetValue (searchset [listview.SelectedItem]);
 			search.CursorPosition = search.Text.ConsoleWidth;
-			Search_Changed (search.Text);
+			Search_Changed (this, new TextChangedEventArgs(search.Text));
 			OnOpenSelectedItem ();
 			Reset (keepSearchText: true);
 			HideList ();
@@ -806,15 +806,15 @@ namespace Terminal.Gui {
 			}
 		}
 
-		private void Search_Changed (ustring text)
+		private void Search_Changed (object sender, TextChangedEventArgs e)
 		{
 			if (source == null) { // Object initialization		
 				return;
 			}
 
-			if (ustring.IsNullOrEmpty (search.Text) && ustring.IsNullOrEmpty (text)) {
+			if (ustring.IsNullOrEmpty (search.Text) && ustring.IsNullOrEmpty (e.OldValue)) {
 				ResetSearchSet ();
-			} else if (search.Text != text) {
+			} else if (search.Text != e.OldValue) {
 				isShow = true;
 				ResetSearchSet (noCopy: true);
 

+ 32 - 0
Terminal.Gui/Views/ContentsChangedEventArgs.cs

@@ -0,0 +1,32 @@
+// TextView.cs: multi-line text editing
+using System;
+
+namespace Terminal.Gui {
+
+	/// <summary>
+	/// Event arguments for events for when the contents of the TextView change. E.g. the <see cref="TextView.ContentsChanged"/> event.
+	/// </summary>
+	public class ContentsChangedEventArgs : EventArgs {
+		/// <summary>
+		/// Creates a new <see cref="TextView.ContentsChanged"/> instance.
+		/// </summary>
+		/// <param name="currentRow">Contains the row where the change occurred.</param>
+		/// <param name="currentColumn">Contains the column where the change occured.</param>
+		public ContentsChangedEventArgs (int currentRow, int currentColumn)
+		{
+			Row = currentRow;
+			Col = currentColumn;
+		}
+
+		/// <summary>
+		/// 
+		/// Contains the row where the change occurred.
+		/// </summary>
+		public int Row { get; private set; }
+
+		/// <summary>
+		/// Contains the column where the change occurred.
+		/// </summary>
+		public int Col { get; private set; }
+	}
+}

+ 7 - 7
Terminal.Gui/Views/ContextMenu.cs

@@ -61,7 +61,7 @@ namespace Terminal.Gui {
 			Position = new Point (x, y);
 		}
 
-		private void MenuBar_MenuAllClosed ()
+		private void MenuBar_MenuAllClosed (object sender, EventArgs e)
 		{
 			Dispose ();
 		}
@@ -145,14 +145,14 @@ namespace Terminal.Gui {
 			menuBar.OpenMenu ();
 		}
 
-		private void Container_Resized (Size obj)
+		private void Container_Resized (object sender, SizeChangedEventArgs e)
 		{
 			if (IsShow) {
 				Show ();
 			}
 		}
 
-		private void Container_Closing (ToplevelClosingEventArgs obj)
+		private void Container_Closing (object sender, ToplevelClosingEventArgs obj)
 		{
 			Hide ();
 		}
@@ -169,12 +169,12 @@ namespace Terminal.Gui {
 		/// <summary>
 		/// Event invoked when the <see cref="ContextMenu.Key"/> is changed.
 		/// </summary>
-		public event Action<Key> KeyChanged;
+		public event EventHandler<KeyChangedEventArgs> KeyChanged;
 
 		/// <summary>
 		/// Event invoked when the <see cref="ContextMenu.MouseFlags"/> is changed.
 		/// </summary>
-		public event Action<MouseFlags> MouseFlagsChanged;
+		public event EventHandler<MouseFlagsChangedEventArgs> MouseFlagsChanged;
 
 		/// <summary>
 		/// Gets or sets the menu position.
@@ -194,7 +194,7 @@ namespace Terminal.Gui {
 			set {
 				var oldKey = key;
 				key = value;
-				KeyChanged?.Invoke (oldKey);
+				KeyChanged?.Invoke (this, new KeyChangedEventArgs(oldKey,key));
 			}
 		}
 
@@ -206,7 +206,7 @@ namespace Terminal.Gui {
 			set {
 				var oldFlags = mouseFlags;
 				mouseFlags = value;
-				MouseFlagsChanged?.Invoke (oldFlags);
+				MouseFlagsChanged?.Invoke (this, new MouseFlagsChangedEventArgs(oldFlags,value));
 			}
 		}
 

+ 5 - 38
Terminal.Gui/Views/DateField.cs

@@ -38,7 +38,7 @@ namespace Terminal.Gui {
 		/// <remarks>
 		///   The passed event arguments containing the old value, new value, and format string.
 		/// </remarks>
-		public event Action<DateTimeEventArgs<DateTime>> DateChanged;
+		public event EventHandler<DateTimeEventArgs<DateTime>> DateChanged;
 
 		/// <summary>
 		///    Initializes a new instance of <see cref="DateField"/> using <see cref="LayoutStyle.Absolute"/> layout.
@@ -106,13 +106,13 @@ namespace Terminal.Gui {
 			AddKeyBinding (Key.F | Key.CtrlMask, Command.Right);
 		}
 
-		void DateField_Changed (ustring e)
+		void DateField_Changed (object sender, TextChangedEventArgs e)
 		{
 			try {
 				if (!DateTime.TryParseExact (GetDate (Text).ToString (), GetInvarianteFormat (), CultureInfo.CurrentCulture, DateTimeStyles.None, out DateTime result))
-					Text = e;
+					Text = e.OldValue;
 			} catch (Exception) {
-				Text = e;
+				Text = e.OldValue;
 			}
 		}
 
@@ -418,40 +418,7 @@ namespace Terminal.Gui {
 		/// <param name="args">Event arguments</param>
 		public virtual void OnDateChanged (DateTimeEventArgs<DateTime> args)
 		{
-			DateChanged?.Invoke (args);
-		}
-	}
-
-	/// <summary>
-	/// Defines the event arguments for <see cref="DateField.DateChanged"/> and <see cref="TimeField.TimeChanged"/> events.
-	/// </summary>
-	public class DateTimeEventArgs<T> : EventArgs {
-		/// <summary>
-		/// The old <see cref="DateField"/> or <see cref="TimeField"/> value.
-		/// </summary>
-		public T OldValue { get; }
-
-		/// <summary>
-		/// The new <see cref="DateField"/> or <see cref="TimeField"/> value.
-		/// </summary>
-		public T NewValue { get; }
-
-		/// <summary>
-		/// The <see cref="DateField"/> or <see cref="TimeField"/> format.
-		/// </summary>
-		public string Format { get; }
-
-		/// <summary>
-		/// Initializes a new instance of <see cref="DateTimeEventArgs{T}"/>
-		/// </summary>
-		/// <param name="oldValue">The old <see cref="DateField"/> or <see cref="TimeField"/> value.</param>
-		/// <param name="newValue">The new <see cref="DateField"/> or <see cref="TimeField"/> value.</param>
-		/// <param name="format">The <see cref="DateField"/> or <see cref="TimeField"/> format string.</param>
-		public DateTimeEventArgs (T oldValue, T newValue, string format)
-		{
-			OldValue = oldValue;
-			NewValue = newValue;
-			Format = format;
+			DateChanged?.Invoke (this,args);
 		}
 	}
 }

+ 43 - 0
Terminal.Gui/Views/DateTimeEventArgs.cs

@@ -0,0 +1,43 @@
+//
+// DateField.cs: text entry for date
+//
+// Author: Barry Nolte
+//
+// Licensed under the MIT license
+//
+using System;
+
+namespace Terminal.Gui {
+	/// <summary>
+	/// Defines the event arguments for <see cref="DateField.DateChanged"/> and <see cref="TimeField.TimeChanged"/> events.
+	/// </summary>
+	public class DateTimeEventArgs<T> : EventArgs {
+		/// <summary>
+		/// The old <see cref="DateField"/> or <see cref="TimeField"/> value.
+		/// </summary>
+		public T OldValue { get; }
+
+		/// <summary>
+		/// The new <see cref="DateField"/> or <see cref="TimeField"/> value.
+		/// </summary>
+		public T NewValue { get; }
+
+		/// <summary>
+		/// The <see cref="DateField"/> or <see cref="TimeField"/> format.
+		/// </summary>
+		public string Format { get; }
+
+		/// <summary>
+		/// Initializes a new instance of <see cref="DateTimeEventArgs{T}"/>
+		/// </summary>
+		/// <param name="oldValue">The old <see cref="DateField"/> or <see cref="TimeField"/> value.</param>
+		/// <param name="newValue">The new <see cref="DateField"/> or <see cref="TimeField"/> value.</param>
+		/// <param name="format">The <see cref="DateField"/> or <see cref="TimeField"/> format string.</param>
+		public DateTimeEventArgs (T oldValue, T newValue, string format)
+		{
+			OldValue = oldValue;
+			NewValue = newValue;
+			Format = format;
+		}
+	}
+}

+ 2 - 45
Terminal.Gui/Views/FrameView.cs

@@ -1,52 +1,15 @@
-using System.Linq;
+using System;
+using System.Linq;
 using System.Text.Json.Serialization;
 using NStack;
 using static Terminal.Gui.Configuration.ConfigurationManager;
 
 namespace Terminal.Gui {
-
 	/// <summary>
 	/// The FrameView is a container frame that draws a frame around the contents. It is similar to
 	/// a GroupBox in Windows.
 	/// </summary>
 	public class FrameView : View {
-
-		//internal class FrameViewConfig : Configuration.Config<FrameViewConfig> {
-
-		//	/// <summary>
-		//	/// 
-		//	/// </summary>
-		//	/// 
-		//	[JsonConverter (typeof (JsonStringEnumConverter))]
-		//	public BorderStyle? DefaultBorderStyle { get; set; }
-
-		//	public override void Apply ()
-		//	{
-		//		if (DefaultBorderStyle.HasValue) {
-		//			FrameView.DefaultBorderStyle = DefaultBorderStyle.Value;
-		//		}
-		//	}
-
-		//	public override void CopyUpdatedProperitesFrom (FrameViewConfig changedConfig)
-		//	{
-		//		if (changedConfig.DefaultBorderStyle.HasValue) {
-		//			DefaultBorderStyle = changedConfig.DefaultBorderStyle;
-		//		}
-		//	}
-
-		//	public override void GetHardCodedDefaults ()
-		//	{
-		//		DefaultBorderStyle = FrameView.DefaultBorderStyle;
-		//	}
-		//}
-
-		//[Configuration.ConfigProperty]
-		//internal static FrameViewConfig Config { get; set; } = new FrameViewConfig ();
-
-
-
-
-
 		/// <summary>
 		/// Initializes a new instance of the <see cref="Gui.FrameView"/> class using <see cref="LayoutStyle.Absolute"/> layout.
 		/// </summary>
@@ -106,12 +69,6 @@ namespace Terminal.Gui {
 			BorderFrame.Data = "BorderFrame";
 		}
 
-		public override void BeginInit ()
-		{
-			base.BeginInit ();
-
-
-		}
 
 		///<inheritdoc/>
 		public override bool OnEnter (View view)

+ 9 - 41
Terminal.Gui/Views/HexView.cs

@@ -34,7 +34,7 @@ namespace Terminal.Gui {
 	/// to an offset in the stream.
 	/// </para>
 	/// </remarks>
-	public class HexView : View {
+	public partial class HexView : View {
 		SortedDictionary<long, byte> edits = new SortedDictionary<long, byte> ();
 		Stream source;
 		long displayStart, pos;
@@ -103,12 +103,12 @@ namespace Terminal.Gui {
 		/// <summary>
 		/// Event to be invoked when an edit is made on the <see cref="Stream"/>.
 		/// </summary>
-		public event Action<KeyValuePair<long, byte>> Edited;
+		public event EventHandler<HexViewEditEventArgs> Edited;
 
 		/// <summary>
 		/// Event to be invoked when the position and cursor position changes.
 		/// </summary>
-		public event Action<HexViewEventArgs> PositionChanged;
+		public event EventHandler<HexViewEventArgs> PositionChanged;
 
 		/// <summary>
 		/// Sets or gets the <see cref="Stream"/> the <see cref="HexView"/> is operating on; the stream must support seeking (<see cref="Stream.CanSeek"/> == true).
@@ -458,11 +458,11 @@ namespace Terminal.Gui {
 					firstNibble = false;
 					b = (byte)(b & 0xf | (value << bsize));
 					edits [position] = b;
-					OnEdited (new KeyValuePair<long, byte> (position, edits [position]));
+					OnEdited (new HexViewEditEventArgs (position, edits [position]));
 				} else {
 					b = (byte)(b & 0xf0 | value);
 					edits [position] = b;
-					OnEdited (new KeyValuePair<long, byte> (position, edits [position]));
+					OnEdited (new HexViewEditEventArgs (position, edits [position]));
 					MoveRight ();
 				}
 				return true;
@@ -473,10 +473,10 @@ namespace Terminal.Gui {
 		/// <summary>
 		/// Method used to invoke the <see cref="Edited"/> event passing the <see cref="KeyValuePair{TKey, TValue}"/>.
 		/// </summary>
-		/// <param name="keyValuePair">The key value pair.</param>
-		public virtual void OnEdited (KeyValuePair<long, byte> keyValuePair)
+		/// <param name="e">The key value pair.</param>
+		public virtual void OnEdited (HexViewEditEventArgs e)
 		{
-			Edited?.Invoke (keyValuePair);
+			Edited?.Invoke (this, e);
 		}
 
 		/// <summary>
@@ -484,7 +484,7 @@ namespace Terminal.Gui {
 		/// </summary>
 		public virtual void OnPositionChanged ()
 		{
-			PositionChanged?.Invoke (new HexViewEventArgs (Position, CursorPosition, BytesPerLine));
+			PositionChanged?.Invoke (this, new HexViewEventArgs (Position, CursorPosition, BytesPerLine));
 		}
 
 		/// <inheritdoc/>
@@ -631,37 +631,5 @@ namespace Terminal.Gui {
 
 			return base.OnEnter (view);
 		}
-
-		/// <summary>
-		/// Defines the event arguments for <see cref="PositionChanged"/> event.
-		/// </summary>
-		public class HexViewEventArgs : EventArgs {
-			/// <summary>
-			/// Gets the current character position starting at one, related to the <see cref="Stream"/>.
-			/// </summary>
-			public long Position { get; private set; }
-			/// <summary>
-			/// Gets the current cursor position starting at one for both, line and column.
-			/// </summary>
-			public Point CursorPosition { get; private set; }
-
-			/// <summary>
-			/// The bytes length per line.
-			/// </summary>
-			public int BytesPerLine { get; private set; }
-
-			/// <summary>
-			/// Initializes a new instance of <see cref="HexViewEventArgs"/>
-			/// </summary>
-			/// <param name="pos">The character position.</param>
-			/// <param name="cursor">The cursor position.</param>
-			/// <param name="lineLength">Line bytes length.</param>
-			public HexViewEventArgs (long pos, Point cursor, int lineLength)
-			{
-				Position = pos;
-				CursorPosition = cursor;
-				BytesPerLine = lineLength;
-			}
-		}
 	}
 }

+ 70 - 0
Terminal.Gui/Views/HexViewEventArgs.cs

@@ -0,0 +1,70 @@
+//
+// HexView.cs: A hexadecimal viewer
+//
+// TODO:
+// - Support searching and highlighting of the search result
+// - Bug showing the last line
+// 
+using System;
+using System.IO;
+
+namespace Terminal.Gui {
+	/// <summary>
+	/// Defines the event arguments for <see cref="HexView.PositionChanged"/> event.
+	/// </summary>
+	public class HexViewEventArgs : EventArgs {
+		/// <summary>
+		/// Gets the current character position starting at one, related to the <see cref="Stream"/>.
+		/// </summary>
+		public long Position { get; private set; }
+		/// <summary>
+		/// Gets the current cursor position starting at one for both, line and column.
+		/// </summary>
+		public Point CursorPosition { get; private set; }
+
+		/// <summary>
+		/// The bytes length per line.
+		/// </summary>
+		public int BytesPerLine { get; private set; }
+
+		/// <summary>
+		/// Initializes a new instance of <see cref="HexViewEventArgs"/>
+		/// </summary>
+		/// <param name="pos">The character position.</param>
+		/// <param name="cursor">The cursor position.</param>
+		/// <param name="lineLength">Line bytes length.</param>
+		public HexViewEventArgs (long pos, Point cursor, int lineLength)
+		{
+			Position = pos;
+			CursorPosition = cursor;
+			BytesPerLine = lineLength;
+		}
+	}
+
+	/// <summary>
+	/// Defines the event arguments for <see cref="HexView.Edited"/> event.
+	/// </summary>
+	public class HexViewEditEventArgs : EventArgs {
+
+		/// <summary>
+		/// Creates a new instance of the <see cref="HexViewEditEventArgs"/> class.
+		/// </summary>
+		/// <param name="position"></param>
+		/// <param name="newValue"></param>
+		public HexViewEditEventArgs (long position, byte newValue)
+		{
+			Position = position;
+			NewValue = newValue;
+		}
+
+		/// <summary>
+		/// Gets the location of the edit.
+		/// </summary>
+		public long Position { get; }
+
+		/// <summary>
+		/// Gets the new value for that <see cref="Position"/>.
+		/// </summary>
+		public byte NewValue { get; }
+	}
+}

+ 36 - 0
Terminal.Gui/Views/HistoryTextItem.cs

@@ -0,0 +1,36 @@
+// TextView.cs: multi-line text editing
+using System;
+using System.Collections.Generic;
+using Rune = System.Rune;
+
+namespace Terminal.Gui {
+	partial class HistoryText {
+		public class HistoryTextItem : EventArgs {
+			public List<List<Rune>> Lines;
+			public Point CursorPosition;
+			public LineStatus LineStatus;
+			public bool IsUndoing;
+			public Point FinalCursorPosition;
+			public HistoryTextItem RemovedOnAdded;
+
+			public HistoryTextItem (List<List<Rune>> lines, Point curPos, LineStatus linesStatus)
+			{
+				Lines = lines;
+				CursorPosition = curPos;
+				LineStatus = linesStatus;
+			}
+
+			public HistoryTextItem (HistoryTextItem historyTextItem)
+			{
+				Lines = new List<List<Rune>> (historyTextItem.Lines);
+				CursorPosition = new Point (historyTextItem.CursorPosition.X, historyTextItem.CursorPosition.Y);
+				LineStatus = historyTextItem.LineStatus;
+			}
+
+			public override string ToString ()
+			{
+				return $"(Count: {Lines.Count}, Cursor: {CursorPosition}, Status: {LineStatus})";
+			}
+		}
+	}
+}

+ 3 - 3
Terminal.Gui/Views/Label.cs

@@ -69,7 +69,7 @@ namespace Terminal.Gui {
 		///   raised when the button is activated either with
 		///   the mouse or the keyboard.
 		/// </remarks>
-		public event Action Clicked;
+		public event EventHandler Clicked;
 
 		/// <summary>
 		/// Method invoked when a mouse event is generated
@@ -78,7 +78,7 @@ namespace Terminal.Gui {
 		/// <returns><c>true</c>, if the event was handled, <c>false</c> otherwise.</returns>
 		public override bool OnMouseEvent (MouseEvent mouseEvent)
 		{
-			MouseEventArgs args = new MouseEventArgs (mouseEvent);
+			MouseEventEventArgs args = new MouseEventEventArgs (mouseEvent);
 			if (OnMouseClick (args))
 				return true;
 			if (MouseEvent (mouseEvent))
@@ -125,7 +125,7 @@ namespace Terminal.Gui {
 		/// </summary>
 		public virtual void OnClicked ()
 		{
-			Clicked?.Invoke ();
+			Clicked?.Invoke (this, EventArgs.Empty);
 		}
 	}
 }

+ 6 - 55
Terminal.Gui/Views/ListView.cs

@@ -395,17 +395,17 @@ namespace Terminal.Gui {
 		/// <summary>
 		/// This event is raised when the selected item in the <see cref="ListView"/> has changed.
 		/// </summary>
-		public event Action<ListViewItemEventArgs> SelectedItemChanged;
+		public event EventHandler<ListViewItemEventArgs> SelectedItemChanged;
 
 		/// <summary>
 		/// This event is raised when the user Double Clicks on an item or presses ENTER to open the selected item.
 		/// </summary>
-		public event Action<ListViewItemEventArgs> OpenSelectedItem;
+		public event EventHandler<ListViewItemEventArgs> OpenSelectedItem;
 
 		/// <summary>
 		/// This event is invoked when this <see cref="ListView"/> is being drawn before rendering.
 		/// </summary>
-		public event Action<ListViewRowEventArgs> RowRender;
+		public event EventHandler<ListViewRowEventArgs> RowRender;
 
 		/// <summary>
 		/// Gets the <see cref="CollectionNavigator"/> that searches the <see cref="ListView.Source"/> collection as
@@ -685,7 +685,7 @@ namespace Terminal.Gui {
 		{
 			if (selected != lastSelectedItem) {
 				var value = source?.Count > 0 ? source.ToList () [selected] : null;
-				SelectedItemChanged?.Invoke (new ListViewItemEventArgs (selected, value));
+				SelectedItemChanged?.Invoke (this, new ListViewItemEventArgs (selected, value));
 				if (HasFocus) {
 					lastSelectedItem = selected;
 				}
@@ -707,7 +707,7 @@ namespace Terminal.Gui {
 
 			var value = source.ToList () [selected];
 
-			OpenSelectedItem?.Invoke (new ListViewItemEventArgs (selected, value));
+			OpenSelectedItem?.Invoke (this, new ListViewItemEventArgs (selected, value));
 
 			return true;
 		}
@@ -718,7 +718,7 @@ namespace Terminal.Gui {
 		/// <param name="rowEventArgs"></param>
 		public virtual void OnRowRender (ListViewRowEventArgs rowEventArgs)
 		{
-			RowRender?.Invoke (rowEventArgs);
+			RowRender?.Invoke (this, rowEventArgs);
 		}
 
 		///<inheritdoc/>
@@ -938,53 +938,4 @@ namespace Terminal.Gui {
 			return -1;
 		}
 	}
-
-	/// <summary>
-	/// <see cref="EventArgs"/> for <see cref="ListView"/> events.
-	/// </summary>
-	public class ListViewItemEventArgs : EventArgs {
-		/// <summary>
-		/// The index of the <see cref="ListView"/> item.
-		/// </summary>
-		public int Item { get; }
-		/// <summary>
-		/// The <see cref="ListView"/> item.
-		/// </summary>
-		public object Value { get; }
-
-		/// <summary>
-		/// Initializes a new instance of <see cref="ListViewItemEventArgs"/>
-		/// </summary>
-		/// <param name="item">The index of the <see cref="ListView"/> item.</param>
-		/// <param name="value">The <see cref="ListView"/> item</param>
-		public ListViewItemEventArgs (int item, object value)
-		{
-			Item = item;
-			Value = value;
-		}
-	}
-
-	/// <summary>
-	/// <see cref="EventArgs"/> used by the <see cref="ListView.RowRender"/> event.
-	/// </summary>
-	public class ListViewRowEventArgs : EventArgs {
-		/// <summary>
-		/// The current row being rendered.
-		/// </summary>
-		public int Row { get; }
-		/// <summary>
-		/// The <see cref="Attribute"/> used by current row or
-		/// null to maintain the current attribute.
-		/// </summary>
-		public Attribute? RowAttribute { get; set; }
-
-		/// <summary>
-		/// Initializes with the current row.
-		/// </summary>
-		/// <param name="row"></param>
-		public ListViewRowEventArgs (int row)
-		{
-			Row = row;
-		}
-	}
 }

+ 52 - 0
Terminal.Gui/Views/ListViewEventArgs.cs

@@ -0,0 +1,52 @@
+using System;
+
+namespace Terminal.Gui {
+	/// <summary>
+	/// <see cref="EventArgs"/> for <see cref="ListView"/> events.
+	/// </summary>
+	public class ListViewItemEventArgs : EventArgs {
+		/// <summary>
+		/// The index of the <see cref="ListView"/> item.
+		/// </summary>
+		public int Item { get; }
+		/// <summary>
+		/// The <see cref="ListView"/> item.
+		/// </summary>
+		public object Value { get; }
+
+		/// <summary>
+		/// Initializes a new instance of <see cref="ListViewItemEventArgs"/>
+		/// </summary>
+		/// <param name="item">The index of the <see cref="ListView"/> item.</param>
+		/// <param name="value">The <see cref="ListView"/> item</param>
+		public ListViewItemEventArgs (int item, object value)
+		{
+			Item = item;
+			Value = value;
+		}
+	}
+
+	/// <summary>
+	/// <see cref="EventArgs"/> used by the <see cref="ListView.RowRender"/> event.
+	/// </summary>
+	public class ListViewRowEventArgs : EventArgs {
+		/// <summary>
+		/// The current row being rendered.
+		/// </summary>
+		public int Row { get; }
+		/// <summary>
+		/// The <see cref="Attribute"/> used by current row or
+		/// null to maintain the current attribute.
+		/// </summary>
+		public Attribute? RowAttribute { get; set; }
+
+		/// <summary>
+		/// Initializes with the current row.
+		/// </summary>
+		/// <param name="row"></param>
+		public ListViewRowEventArgs (int row)
+		{
+			Row = row;
+		}
+	}
+}

+ 16 - 80
Terminal.Gui/Views/Menu.cs

@@ -1044,7 +1044,7 @@ namespace Terminal.Gui {
 
 		bool _initialCanFocus;
 
-		private void MenuBar_Added (View obj)
+		private void MenuBar_Added (object sender, SuperViewChangedEventArgs e)
 		{
 			_initialCanFocus = CanFocus;
 			Added -= MenuBar_Added;
@@ -1205,22 +1205,22 @@ namespace Terminal.Gui {
 		/// <summary>
 		/// Raised as a menu is opening.
 		/// </summary>
-		public event Action<MenuOpeningEventArgs> MenuOpening;
+		public event EventHandler<MenuOpeningEventArgs> MenuOpening;
 
 		/// <summary>
 		/// Raised when a menu is opened.
 		/// </summary>
-		public event Action<MenuItem> MenuOpened;
+		public event EventHandler<MenuOpenedEventArgs> MenuOpened;
 
 		/// <summary>
 		/// Raised when a menu is closing passing <see cref="MenuClosingEventArgs"/>.
 		/// </summary>
-		public event Action<MenuClosingEventArgs> MenuClosing;
+		public event EventHandler<MenuClosingEventArgs> MenuClosing;
 
 		/// <summary>
 		/// Raised when all the menu is closed.
 		/// </summary>
-		public event Action MenuAllClosed;
+		public event EventHandler MenuAllClosed;
 
 		internal Menu openMenu;
 		Menu ocm;
@@ -1253,7 +1253,7 @@ namespace Terminal.Gui {
 		public virtual MenuOpeningEventArgs OnMenuOpening (MenuBarItem currentMenu)
 		{
 			var ev = new MenuOpeningEventArgs (currentMenu);
-			MenuOpening?.Invoke (ev);
+			MenuOpening?.Invoke (this, ev);
 			return ev;
 		}
 
@@ -1263,16 +1263,20 @@ namespace Terminal.Gui {
 		public virtual void OnMenuOpened ()
 		{
 			MenuItem mi = null;
+			MenuBarItem parent;
+
 			if (openCurrentMenu.barItems.Children != null && openCurrentMenu.barItems.Children.Length > 0
 				&& openCurrentMenu?.current > -1) {
-
-				mi = openCurrentMenu.barItems.Children [openCurrentMenu.current];
+				parent = openCurrentMenu.barItems;
+				mi = parent.Children [openCurrentMenu.current];
 			} else if (openCurrentMenu.barItems.IsTopLevel) {
+				parent = null;
 				mi = openCurrentMenu.barItems;
 			} else {
-				mi = openMenu.barItems.Children [openMenu.current];
+				parent = openMenu.barItems;
+				mi = parent.Children [openMenu.current];
 			}
-			MenuOpened?.Invoke (mi);
+			MenuOpened?.Invoke (this, new MenuOpenedEventArgs (parent, mi));
 		}
 
 		/// <summary>
@@ -1284,7 +1288,7 @@ namespace Terminal.Gui {
 		public virtual MenuClosingEventArgs OnMenuClosing (MenuBarItem currentMenu, bool reopen, bool isSubMenu)
 		{
 			var ev = new MenuClosingEventArgs (currentMenu, reopen, isSubMenu);
-			MenuClosing?.Invoke (ev);
+			MenuClosing?.Invoke (this, ev);
 			return ev;
 		}
 
@@ -1293,7 +1297,7 @@ namespace Terminal.Gui {
 		/// </summary>
 		public virtual void OnMenuAllClosed ()
 		{
-			MenuAllClosed?.Invoke ();
+			MenuAllClosed?.Invoke (this, EventArgs.Empty);
 		}
 
 		View lastFocused;
@@ -2011,72 +2015,4 @@ namespace Terminal.Gui {
 			return base.OnEnter (view);
 		}
 	}
-
-	/// <summary>
-	/// An <see cref="EventArgs"/> which allows passing a cancelable menu opening event or replacing with a new <see cref="MenuBarItem"/>.
-	/// </summary>
-	public class MenuOpeningEventArgs : EventArgs {
-		/// <summary>
-		/// The current <see cref="MenuBarItem"/> parent.
-		/// </summary>
-		public MenuBarItem CurrentMenu { get; }
-
-		/// <summary>
-		/// The new <see cref="MenuBarItem"/> to be replaced.
-		/// </summary>
-		public MenuBarItem NewMenuBarItem { get; set; }
-		/// <summary>
-		/// Flag that allows the cancellation of the event. If set to <see langword="true"/> in the
-		/// event handler, the event will be canceled. 
-		/// </summary>
-		public bool Cancel { get; set; }
-
-		/// <summary>
-		/// Initializes a new instance of <see cref="MenuOpeningEventArgs"/>.
-		/// </summary>
-		/// <param name="currentMenu">The current <see cref="MenuBarItem"/> parent.</param>
-		public MenuOpeningEventArgs (MenuBarItem currentMenu)
-		{
-			CurrentMenu = currentMenu;
-		}
-	}
-
-	/// <summary>
-	/// An <see cref="EventArgs"/> which allows passing a cancelable menu closing event.
-	/// </summary>
-	public class MenuClosingEventArgs : EventArgs {
-		/// <summary>
-		/// The current <see cref="MenuBarItem"/> parent.
-		/// </summary>
-		public MenuBarItem CurrentMenu { get; }
-
-		/// <summary>
-		/// Indicates whether the current menu will reopen.
-		/// </summary>
-		public bool Reopen { get; }
-
-		/// <summary>
-		/// Indicates whether the current menu is a sub-menu.
-		/// </summary>
-		public bool IsSubMenu { get; }
-
-		/// <summary>
-		/// Flag that allows the cancellation of the event. If set to <see langword="true"/> in the
-		/// event handler, the event will be canceled. 
-		/// </summary>
-		public bool Cancel { get; set; }
-
-		/// <summary>
-		/// Initializes a new instance of <see cref="MenuClosingEventArgs"/>.
-		/// </summary>
-		/// <param name="currentMenu">The current <see cref="MenuBarItem"/> parent.</param>
-		/// <param name="reopen">Whether the current menu will reopen.</param>
-		/// <param name="isSubMenu">Indicates whether it is a sub-menu.</param>
-		public MenuClosingEventArgs (MenuBarItem currentMenu, bool reopen, bool isSubMenu)
-		{
-			CurrentMenu = currentMenu;
-			Reopen = reopen;
-			IsSubMenu = isSubMenu;
-		}
-	}
 }

+ 98 - 0
Terminal.Gui/Views/MenuEventArgs.cs

@@ -0,0 +1,98 @@
+using System;
+
+namespace Terminal.Gui {
+	/// <summary>
+	/// An <see cref="EventArgs"/> which allows passing a cancelable menu opening event or replacing with a new <see cref="MenuBarItem"/>.
+	/// </summary>
+	public class MenuOpeningEventArgs : EventArgs {
+		/// <summary>
+		/// The current <see cref="MenuBarItem"/> parent.
+		/// </summary>
+		public MenuBarItem CurrentMenu { get; }
+
+		/// <summary>
+		/// The new <see cref="MenuBarItem"/> to be replaced.
+		/// </summary>
+		public MenuBarItem NewMenuBarItem { get; set; }
+		/// <summary>
+		/// Flag that allows the cancellation of the event. If set to <see langword="true"/> in the
+		/// event handler, the event will be canceled. 
+		/// </summary>
+		public bool Cancel { get; set; }
+
+		/// <summary>
+		/// Initializes a new instance of <see cref="MenuOpeningEventArgs"/>.
+		/// </summary>
+		/// <param name="currentMenu">The current <see cref="MenuBarItem"/> parent.</param>
+		public MenuOpeningEventArgs (MenuBarItem currentMenu)
+		{
+			CurrentMenu = currentMenu;
+		}
+	}
+
+	/// <summary>
+	/// Defines arguments for the <see cref="MenuBar.MenuOpened"/> event
+	/// </summary>
+	public class MenuOpenedEventArgs : EventArgs {
+		/// <summary>
+		/// Creates a new instance of the <see cref="MenuOpenedEventArgs"/> class
+		/// </summary>
+		/// <param name="parent"></param>
+		/// <param name="menuItem"></param>
+		public MenuOpenedEventArgs (MenuBarItem parent, MenuItem menuItem)
+		{
+			Parent = parent;
+			MenuItem = menuItem;
+		}
+
+		/// <summary>
+		/// The parent of <see cref="MenuItem"/>.  Will be null if menu opening
+		/// is the root (see <see cref="MenuBarItem.IsTopLevel"/>).
+		/// </summary>
+		public MenuBarItem Parent { get; }
+
+		/// <summary>
+		/// Gets the <see cref="MenuItem"/> being opened.
+		/// </summary>
+		public MenuItem MenuItem { get; }
+	}
+
+	/// <summary>
+	/// An <see cref="EventArgs"/> which allows passing a cancelable menu closing event.
+	/// </summary>
+	public class MenuClosingEventArgs : EventArgs {
+		/// <summary>
+		/// The current <see cref="MenuBarItem"/> parent.
+		/// </summary>
+		public MenuBarItem CurrentMenu { get; }
+
+		/// <summary>
+		/// Indicates whether the current menu will reopen.
+		/// </summary>
+		public bool Reopen { get; }
+
+		/// <summary>
+		/// Indicates whether the current menu is a sub-menu.
+		/// </summary>
+		public bool IsSubMenu { get; }
+
+		/// <summary>
+		/// Flag that allows the cancellation of the event. If set to <see langword="true"/> in the
+		/// event handler, the event will be canceled. 
+		/// </summary>
+		public bool Cancel { get; set; }
+
+		/// <summary>
+		/// Initializes a new instance of <see cref="MenuClosingEventArgs"/>.
+		/// </summary>
+		/// <param name="currentMenu">The current <see cref="MenuBarItem"/> parent.</param>
+		/// <param name="reopen">Whether the current menu will reopen.</param>
+		/// <param name="isSubMenu">Indicates whether it is a sub-menu.</param>
+		public MenuClosingEventArgs (MenuBarItem currentMenu, bool reopen, bool isSubMenu)
+		{
+			CurrentMenu = currentMenu;
+			Reopen = reopen;
+			IsSubMenu = isSubMenu;
+		}
+	}
+}

+ 2 - 28
Terminal.Gui/Views/RadioGroup.cs

@@ -265,7 +265,7 @@ namespace Terminal.Gui {
 		/// <summary>
 		/// Invoked when the selected radio label has changed.
 		/// </summary>
-		public event Action<SelectedItemChangedArgs> SelectedItemChanged;
+		public event EventHandler<SelectedItemChangedArgs> SelectedItemChanged;
 
 		/// <summary>
 		/// The currently selected item from the list of radio labels
@@ -296,7 +296,7 @@ namespace Terminal.Gui {
 		public virtual void OnSelectedItemChanged (int selectedItem, int previousSelectedItem)
 		{
 			selected = selectedItem;
-			SelectedItemChanged?.Invoke (new SelectedItemChangedArgs (selectedItem, previousSelectedItem));
+			SelectedItemChanged?.Invoke (this, new SelectedItemChangedArgs (selectedItem, previousSelectedItem));
 		}
 
 		///<inheritdoc/>
@@ -422,30 +422,4 @@ namespace Terminal.Gui {
 		/// </summary>
 		Horizontal
 	}
-
-	/// <summary>
-	/// Event arguments for the SelectedItemChagned event.
-	/// </summary>
-	public class SelectedItemChangedArgs : EventArgs {
-		/// <summary>
-		/// Gets the index of the item that was previously selected. -1 if there was no previous selection.
-		/// </summary>
-		public int PreviousSelectedItem { get; }
-
-		/// <summary>
-		/// Gets the index of the item that is now selected. -1 if there is no selection.
-		/// </summary>
-		public int SelectedItem { get; }
-
-		/// <summary>
-		/// Initializes a new <see cref="SelectedItemChangedArgs"/> class.
-		/// </summary>
-		/// <param name="selectedItem"></param>
-		/// <param name="previousSelectedItem"></param>
-		public SelectedItemChangedArgs (int selectedItem, int previousSelectedItem)
-		{
-			PreviousSelectedItem = previousSelectedItem;
-			SelectedItem = selectedItem;
-		}
-	}
 }

+ 5 - 5
Terminal.Gui/Views/ScrollBarView.cs

@@ -119,7 +119,7 @@ namespace Terminal.Gui {
 			ClearOnVisibleFalse = false;
 		}
 
-		private void Host_VisibleChanged ()
+		private void Host_VisibleChanged (object sender, EventArgs e)
 		{
 			if (!Host.Visible) {
 				Visible = Host.Visible;
@@ -132,7 +132,7 @@ namespace Terminal.Gui {
 			}
 		}
 
-		private void Host_EnabledChanged ()
+		private void Host_EnabledChanged (object sender, EventArgs e)
 		{
 			Enabled = Host.Enabled;
 			if (otherScrollBarView != null) {
@@ -149,7 +149,7 @@ namespace Terminal.Gui {
 		//	}
 		//}
 
-		void ContentBottomRightCorner_MouseClick (MouseEventArgs me)
+		void ContentBottomRightCorner_MouseClick (object sender, MouseEventEventArgs me)
 		{
 			if (me.MouseEvent.Flags == MouseFlags.WheeledDown || me.MouseEvent.Flags == MouseFlags.WheeledUp
 				|| me.MouseEvent.Flags == MouseFlags.WheeledRight || me.MouseEvent.Flags == MouseFlags.WheeledLeft) {
@@ -199,7 +199,7 @@ namespace Terminal.Gui {
 		/// <summary>
 		/// This event is raised when the position on the scrollbar has changed.
 		/// </summary>
-		public event Action ChangedPosition;
+		public event EventHandler ChangedPosition;
 
 		/// <summary>
 		/// The position, relative to <see cref="Size"/>, to set the scrollbar at.
@@ -313,7 +313,7 @@ namespace Terminal.Gui {
 		/// </summary>
 		public virtual void OnChangedPosition ()
 		{
-			ChangedPosition?.Invoke ();
+			ChangedPosition?.Invoke (this, EventArgs.Empty);
 		}
 
 		/// <summary>

+ 2 - 2
Terminal.Gui/Views/ScrollView.cs

@@ -237,14 +237,14 @@ namespace Terminal.Gui {
 			SetNeedsLayout ();
 		}
 
-		void View_MouseLeave (MouseEventArgs e)
+		void View_MouseLeave (object sender, MouseEventEventArgs e)
 		{
 			if (Application.MouseGrabView != null && Application.MouseGrabView != vertical && Application.MouseGrabView != horizontal) {
 				Application.UngrabMouse ();
 			}
 		}
 
-		void View_MouseEnter (MouseEventArgs e)
+		void View_MouseEnter (object sender, MouseEventEventArgs e)
 		{
 			Application.GrabMouse (this);
 		}

+ 63 - 0
Terminal.Gui/Views/SelectedCellChangedEventArgs.cs

@@ -0,0 +1,63 @@
+using System;
+using System.Data;
+
+namespace Terminal.Gui {
+
+
+	/// <summary>
+	/// Defines the event arguments for <see cref="TableView.SelectedCellChanged"/> 
+	/// </summary>
+	public class SelectedCellChangedEventArgs : EventArgs {
+		/// <summary>
+		/// The current table to which the new indexes refer.  May be null e.g. if selection change is the result of clearing the table from the view
+		/// </summary>
+		/// <value></value>
+		public DataTable Table { get; }
+
+
+		/// <summary>
+		/// The previous selected column index.  May be invalid e.g. when the selection has been changed as a result of replacing the existing Table with a smaller one
+		/// </summary>
+		/// <value></value>
+		public int OldCol { get; }
+
+
+		/// <summary>
+		/// The newly selected column index.
+		/// </summary>
+		/// <value></value>
+		public int NewCol { get; }
+
+
+		/// <summary>
+		/// The previous selected row index.  May be invalid e.g. when the selection has been changed as a result of deleting rows from the table
+		/// </summary>
+		/// <value></value>
+		public int OldRow { get; }
+
+
+		/// <summary>
+		/// The newly selected row index.
+		/// </summary>
+		/// <value></value>
+		public int NewRow { get; }
+
+		/// <summary>
+		/// Creates a new instance of arguments describing a change in selected cell in a <see cref="TableView"/>
+		/// </summary>
+		/// <param name="t"></param>
+		/// <param name="oldCol"></param>
+		/// <param name="newCol"></param>
+		/// <param name="oldRow"></param>
+		/// <param name="newRow"></param>
+		public SelectedCellChangedEventArgs (DataTable t, int oldCol, int newCol, int oldRow, int newRow)
+		{
+			Table = t;
+			OldCol = oldCol;
+			NewCol = newCol;
+			OldRow = oldRow;
+			NewRow = newRow;
+		}
+	}
+
+}

+ 29 - 0
Terminal.Gui/Views/SelectedItemChangedArgs.cs

@@ -0,0 +1,29 @@
+using System;
+
+namespace Terminal.Gui {
+	/// <summary>
+	/// Event arguments for the SelectedItemChagned event.
+	/// </summary>
+	public class SelectedItemChangedArgs : EventArgs {
+		/// <summary>
+		/// Gets the index of the item that was previously selected. -1 if there was no previous selection.
+		/// </summary>
+		public int PreviousSelectedItem { get; }
+
+		/// <summary>
+		/// Gets the index of the item that is now selected. -1 if there is no selection.
+		/// </summary>
+		public int SelectedItem { get; }
+
+		/// <summary>
+		/// Initializes a new <see cref="SelectedItemChangedArgs"/> class.
+		/// </summary>
+		/// <param name="selectedItem"></param>
+		/// <param name="previousSelectedItem"></param>
+		public SelectedItemChangedArgs (int selectedItem, int previousSelectedItem)
+		{
+			PreviousSelectedItem = previousSelectedItem;
+			SelectedItem = selectedItem;
+		}
+	}
+}

+ 38 - 0
Terminal.Gui/Views/SplitterEventArgs.cs

@@ -0,0 +1,38 @@
+using System;
+
+namespace Terminal.Gui {
+	/// <summary>
+	/// Provides data for <see cref="TileView"/> events.
+	/// </summary>
+	public class SplitterEventArgs : EventArgs {
+
+		/// <summary>
+		/// Creates a new instance of the <see cref="SplitterEventArgs"/> class.
+		/// </summary>
+		/// <param name="tileView"><see cref="TileView"/> in which splitter is being moved.</param>
+		/// <param name="idx">Index of the splitter being moved in <see cref="TileView.SplitterDistances"/>.</param>
+		/// <param name="splitterDistance">The new <see cref="Pos"/> of the splitter line.</param>
+		public SplitterEventArgs (TileView tileView, int idx, Pos splitterDistance)
+		{
+			SplitterDistance = splitterDistance;
+			TileView = tileView;
+			Idx = idx;
+		}
+
+		/// <summary>
+		/// New position of the splitter line (see <see cref="TileView.SplitterDistances"/>).
+		/// </summary>
+		public Pos SplitterDistance { get; }
+
+		/// <summary>
+		/// Container (sender) of the event.
+		/// </summary>
+		public TileView TileView { get; }
+
+		/// <summary>
+		/// Gets the index of the splitter that is being moved. This can be
+		/// used to index <see cref="TileView.SplitterDistances"/>
+		/// </summary>
+		public int Idx { get; }
+	}
+}

+ 31 - 0
Terminal.Gui/Views/TabChangedEventArgs.cs

@@ -0,0 +1,31 @@
+using System;
+
+namespace Terminal.Gui {
+
+	/// <summary>
+	/// Describes a change in <see cref="TabView.SelectedTab"/>
+	/// </summary>
+	public class TabChangedEventArgs : EventArgs {
+
+		/// <summary>
+		/// The previously selected tab. May be null
+		/// </summary>
+		public TabView.Tab OldTab { get; }
+
+		/// <summary>
+		/// The currently selected tab. May be null
+		/// </summary>
+		public TabView.Tab NewTab { get; }
+
+		/// <summary>
+		/// Documents a tab change
+		/// </summary>
+		/// <param name="oldTab"></param>
+		/// <param name="newTab"></param>
+		public TabChangedEventArgs (TabView.Tab oldTab, TabView.Tab newTab)
+		{
+			OldTab = oldTab;
+			NewTab = newTab;
+		}
+	}
+}

+ 35 - 0
Terminal.Gui/Views/TabMouseEventArgs.cs

@@ -0,0 +1,35 @@
+using System;
+
+namespace Terminal.Gui {
+
+	/// <summary>
+	/// Describes a mouse event over a specific <see cref="TabView.Tab"/> in a <see cref="TabView"/>.
+	/// </summary>
+	public class TabMouseEventArgs : EventArgs {
+
+		/// <summary>
+		/// Gets the <see cref="TabView.Tab"/> (if any) that the mouse
+		/// was over when the <see cref="MouseEvent"/> occurred.
+		/// </summary>
+		/// <remarks>This will be null if the click is after last tab
+		/// or before first.</remarks>
+		public TabView.Tab Tab { get; }
+
+		/// <summary>
+		/// Gets the actual mouse event.  Use <see cref="MouseEvent.Handled"/> to cancel this event
+		/// and perform custom behavior (e.g. show a context menu).
+		/// </summary>
+		public MouseEvent MouseEvent { get; }
+
+		/// <summary>
+		/// Creates a new instance of the <see cref="TabMouseEventArgs"/> class.
+		/// </summary>
+		/// <param name="tab"><see cref="TabView.Tab"/> that the mouse was over when the event occurred.</param>
+		/// <param name="mouseEvent">The mouse activity being reported</param>
+		public TabMouseEventArgs (TabView.Tab tab, MouseEvent mouseEvent)
+		{
+			Tab = tab;
+			MouseEvent = mouseEvent;
+		}
+	}
+}

+ 1 - 59
Terminal.Gui/Views/TabView.cs

@@ -9,7 +9,7 @@ namespace Terminal.Gui {
 	/// <summary>
 	/// Control that hosts multiple sub views, presenting a single one at once
 	/// </summary>
-	public class TabView : View {
+	public partial class TabView : View {
 		private Tab selectedTab;
 
 		/// <summary>
@@ -771,37 +771,6 @@ namespace Terminal.Gui {
 			TabClicked?.Invoke (this, tabMouseEventArgs);
 		}
 
-		/// <summary>
-		/// Describes a mouse event over a specific <see cref="TabView.Tab"/> in a <see cref="TabView"/>.
-		/// </summary>
-		public class TabMouseEventArgs : EventArgs {
-
-			/// <summary>
-			/// Gets the <see cref="TabView.Tab"/> (if any) that the mouse
-			/// was over when the <see cref="MouseEvent"/> occurred.
-			/// </summary>
-			/// <remarks>This will be null if the click is after last tab
-			/// or before first.</remarks>
-			public Tab Tab { get; }
-
-			/// <summary>
-			/// Gets the actual mouse event.  Use <see cref="MouseEvent.Handled"/> to cancel this event
-			/// and perform custom behavior (e.g. show a context menu).
-			/// </summary>
-			public MouseEvent MouseEvent { get; }
-
-			/// <summary>
-			/// Creates a new instance of the <see cref="TabMouseEventArgs"/> class.
-			/// </summary>
-			/// <param name="tab"><see cref="TabView.Tab"/> that the mouse was over when the event occurred.</param>
-			/// <param name="mouseEvent">The mouse activity being reported</param>
-			public TabMouseEventArgs (Tab tab, MouseEvent mouseEvent)
-			{
-				Tab = tab;
-				MouseEvent = mouseEvent;
-			}
-		}
-
 		/// <summary>
 		/// A single tab in a <see cref="TabView"/>
 		/// </summary>
@@ -867,33 +836,6 @@ namespace Terminal.Gui {
 			public bool TabsOnBottom { get; set; } = false;
 
 		}
-
-		/// <summary>
-		/// Describes a change in <see cref="TabView.SelectedTab"/>
-		/// </summary>
-		public class TabChangedEventArgs : EventArgs {
-
-			/// <summary>
-			/// The previously selected tab. May be null
-			/// </summary>
-			public Tab OldTab { get; }
-
-			/// <summary>
-			/// The currently selected tab. May be null
-			/// </summary>
-			public Tab NewTab { get; }
-
-			/// <summary>
-			/// Documents a tab change
-			/// </summary>
-			/// <param name="oldTab"></param>
-			/// <param name="newTab"></param>
-			public TabChangedEventArgs (Tab oldTab, Tab newTab)
-			{
-				OldTab = oldTab;
-				NewTab = newTab;
-			}
-		}
 		#endregion
 	}
 }

+ 5 - 98
Terminal.Gui/Views/TableView.cs

@@ -13,44 +13,7 @@ namespace Terminal.Gui {
 	/// 
 	/// <a href="https://gui-cs.github.io/Terminal.Gui/articles/tableview.html">See TableView Deep Dive for more information</a>.
 	/// </summary>
-	public class TableView : View {
-
-		/// <summary>
-		///  Defines the event arguments for <see cref="TableView.CellActivated"/> event
-		/// </summary>
-		public class CellActivatedEventArgs : EventArgs {
-			/// <summary>
-			/// The current table to which the new indexes refer.  May be null e.g. if selection change is the result of clearing the table from the view
-			/// </summary>
-			/// <value></value>
-			public DataTable Table { get; }
-
-
-			/// <summary>
-			/// The column index of the <see cref="Table"/> cell that is being activated
-			/// </summary>
-			/// <value></value>
-			public int Col { get; }
-
-			/// <summary>
-			/// The row index of the <see cref="Table"/> cell that is being activated
-			/// </summary>
-			/// <value></value>
-			public int Row { get; }
-
-			/// <summary>
-			/// Creates a new instance of arguments describing a cell being activated in <see cref="TableView"/>
-			/// </summary>
-			/// <param name="t"></param>
-			/// <param name="col"></param>
-			/// <param name="row"></param>
-			public CellActivatedEventArgs (DataTable t, int col, int row)
-			{
-				Table = t;
-				Col = col;
-				Row = row;
-			}
-		}
+	public partial class TableView : View {
 
 		private int columnOffset;
 		private int rowOffset;
@@ -171,12 +134,12 @@ namespace Terminal.Gui {
 		/// <summary>
 		/// This event is raised when the selected cell in the table changes.
 		/// </summary>
-		public event Action<SelectedCellChangedEventArgs> SelectedCellChanged;
+		public event EventHandler<SelectedCellChangedEventArgs> SelectedCellChanged;
 
 		/// <summary>
 		/// This event is raised when a cell is activated e.g. by double clicking or pressing <see cref="CellActivationKey"/>
 		/// </summary>
-		public event Action<CellActivatedEventArgs> CellActivated;
+		public event EventHandler<CellActivatedEventArgs> CellActivated;
 
 		/// <summary>
 		/// The key which when pressed should trigger <see cref="CellActivated"/> event.  Defaults to Enter.
@@ -1510,7 +1473,7 @@ namespace Terminal.Gui {
 		/// </summary>
 		protected virtual void OnSelectedCellChanged (SelectedCellChangedEventArgs args)
 		{
-			SelectedCellChanged?.Invoke (args);
+			SelectedCellChanged?.Invoke (this,args);
 		}
 
 		/// <summary>
@@ -1519,7 +1482,7 @@ namespace Terminal.Gui {
 		/// <param name="args"></param>
 		protected virtual void OnCellActivated (CellActivatedEventArgs args)
 		{
-			CellActivated?.Invoke (args);
+			CellActivated?.Invoke (this, args);
 		}
 
 		/// <summary>
@@ -2001,62 +1964,6 @@ namespace Terminal.Gui {
 			}
 		}
 
-		/// <summary>
-		/// Defines the event arguments for <see cref="TableView.SelectedCellChanged"/> 
-		/// </summary>
-		public class SelectedCellChangedEventArgs : EventArgs {
-			/// <summary>
-			/// The current table to which the new indexes refer.  May be null e.g. if selection change is the result of clearing the table from the view
-			/// </summary>
-			/// <value></value>
-			public DataTable Table { get; }
-
-
-			/// <summary>
-			/// The previous selected column index.  May be invalid e.g. when the selection has been changed as a result of replacing the existing Table with a smaller one
-			/// </summary>
-			/// <value></value>
-			public int OldCol { get; }
-
-
-			/// <summary>
-			/// The newly selected column index.
-			/// </summary>
-			/// <value></value>
-			public int NewCol { get; }
-
-
-			/// <summary>
-			/// The previous selected row index.  May be invalid e.g. when the selection has been changed as a result of deleting rows from the table
-			/// </summary>
-			/// <value></value>
-			public int OldRow { get; }
-
-
-			/// <summary>
-			/// The newly selected row index.
-			/// </summary>
-			/// <value></value>
-			public int NewRow { get; }
-
-			/// <summary>
-			/// Creates a new instance of arguments describing a change in selected cell in a <see cref="TableView"/>
-			/// </summary>
-			/// <param name="t"></param>
-			/// <param name="oldCol"></param>
-			/// <param name="newCol"></param>
-			/// <param name="oldRow"></param>
-			/// <param name="newRow"></param>
-			public SelectedCellChangedEventArgs (DataTable t, int oldCol, int newCol, int oldRow, int newRow)
-			{
-				Table = t;
-				OldCol = oldCol;
-				NewCol = newCol;
-				OldRow = oldRow;
-				NewRow = newRow;
-			}
-		}
-
 		/// <summary>
 		/// Describes a selected region of the table
 		/// </summary>

+ 31 - 0
Terminal.Gui/Views/TextChangedEventArgs.cs

@@ -0,0 +1,31 @@
+//
+// TextField.cs: single-line text editor with Emacs keybindings
+//
+// Authors:
+//   Miguel de Icaza ([email protected])
+//
+
+using System;
+using NStack;
+
+namespace Terminal.Gui {
+	/// <summary>
+	/// Event args for the <see cref="TextField.TextChanged"/> event
+	/// </summary>
+	public class TextChangedEventArgs : EventArgs {
+
+		/// <summary>
+		/// Creates a new instance of the <see cref="TextChangedEventArgs"/> class
+		/// </summary>
+		/// <param name="oldValue"></param>
+		public TextChangedEventArgs (ustring oldValue)
+		{
+			OldValue = oldValue;
+		}
+
+		/// <summary>
+		/// The old value before the text changed
+		/// </summary>
+		public ustring OldValue { get; }
+	}
+}

+ 34 - 0
Terminal.Gui/Views/TextChangingEventArgs.cs

@@ -0,0 +1,34 @@
+//
+// TextField.cs: single-line text editor with Emacs keybindings
+//
+// Authors:
+//   Miguel de Icaza ([email protected])
+//
+
+using System;
+using NStack;
+
+namespace Terminal.Gui {
+	/// <summary>
+	/// An <see cref="EventArgs"/> which allows passing a cancelable new text value event.
+	/// </summary>
+	public class TextChangingEventArgs : EventArgs {
+		/// <summary>
+		/// The new text to be replaced.
+		/// </summary>
+		public ustring NewText { get; set; }
+		/// <summary>
+		/// Flag which allows to cancel the new text value.
+		/// </summary>
+		public bool Cancel { get; set; }
+
+		/// <summary>
+		/// Initializes a new instance of <see cref="TextChangingEventArgs"/>
+		/// </summary>
+		/// <param name="newText">The new <see cref="TextField.Text"/> to be replaced.</param>
+		public TextChangingEventArgs (ustring newText)
+		{
+			NewText = newText;
+		}
+	}
+}

+ 7 - 31
Terminal.Gui/Views/TextField.cs

@@ -42,7 +42,7 @@ namespace Terminal.Gui {
 		/// <summary>
 		/// Changing event, raised before the <see cref="Text"/> changes and can be canceled or changing the new text.
 		/// </summary>
-		public event Action<TextChangingEventArgs> TextChanging;
+		public event EventHandler<TextChangingEventArgs> TextChanging;
 
 		/// <summary>
 		///   Changed event, raised when the text has changed.
@@ -53,7 +53,7 @@ namespace Terminal.Gui {
 		/// <remarks>
 		///   The passed <see cref="EventArgs"/> is a <see cref="NStack.ustring"/> containing the old value. 
 		/// </remarks>
-		public event Action<ustring> TextChanged;
+		public event EventHandler<TextChangedEventArgs> TextChanged;
 
 		/// <summary>
 		/// Initializes a new instance of the <see cref="TextField"/> class using <see cref="LayoutStyle.Computed"/> positioning.
@@ -228,12 +228,12 @@ namespace Terminal.Gui {
 				});
 		}
 
-		private void ContextMenu_KeyChanged (Key obj)
+		private void ContextMenu_KeyChanged (object sender, KeyChangedEventArgs e)
 		{
-			ReplaceKeyBinding (obj, ContextMenu.Key);
+			ReplaceKeyBinding (e.OldKey, e.NewKey);
 		}
 
-		private void HistoryText_ChangeText (HistoryText.HistoryTextItem obj)
+		private void HistoryText_ChangeText (object sender, HistoryText.HistoryTextItem obj)
 		{
 			if (obj == null)
 				return;
@@ -308,7 +308,7 @@ namespace Terminal.Gui {
 						, HistoryText.LineStatus.Replaced);
 				}
 
-				TextChanged?.Invoke (oldText);
+				TextChanged?.Invoke (this, new TextChangedEventArgs(oldText));
 
 				if (point > text.Count) {
 					point = Math.Max (TextModel.DisplaySize (text, 0).size - 1, 0);
@@ -1249,7 +1249,7 @@ namespace Terminal.Gui {
 		public virtual TextChangingEventArgs OnTextChanging (ustring newText)
 		{
 			var ev = new TextChangingEventArgs (newText);
-			TextChanging?.Invoke (ev);
+			TextChanging?.Invoke (this, ev);
 			return ev;
 		}
 
@@ -1308,30 +1308,6 @@ namespace Terminal.Gui {
 			historyText.Clear (Text);
 		}
 	}
-
-	/// <summary>
-	/// An <see cref="EventArgs"/> which allows passing a cancelable new text value event.
-	/// </summary>
-	public class TextChangingEventArgs : EventArgs {
-		/// <summary>
-		/// The new text to be replaced.
-		/// </summary>
-		public ustring NewText { get; set; }
-		/// <summary>
-		/// Flag which allows to cancel the new text value.
-		/// </summary>
-		public bool Cancel { get; set; }
-
-		/// <summary>
-		/// Initializes a new instance of <see cref="TextChangingEventArgs"/>
-		/// </summary>
-		/// <param name="newText">The new <see cref="TextField.Text"/> to be replaced.</param>
-		public TextChangingEventArgs (ustring newText)
-		{
-			NewText = newText;
-		}
-	}
-
 	/// <summary>
 	/// Renders an overlay on another view at a given point that allows selecting
 	/// from a range of 'autocomplete' options.

+ 20 - 75
Terminal.Gui/Views/TextView.cs

@@ -16,7 +16,7 @@ namespace Terminal.Gui {
 	class TextModel {
 		List<List<Rune>> lines = new List<List<Rune>> ();
 
-		public event Action LinesLoaded;
+		public event EventHandler LinesLoaded;
 
 		public bool LoadFile (string file)
 		{
@@ -120,7 +120,7 @@ namespace Terminal.Gui {
 
 		void OnLinesLoaded ()
 		{
-			LinesLoaded?.Invoke ();
+			LinesLoaded?.Invoke (this, EventArgs.Empty);
 		}
 
 		public override string ToString ()
@@ -515,7 +515,7 @@ namespace Terminal.Gui {
 		}
 	}
 
-	class HistoryText {
+	partial class HistoryText {
 		public enum LineStatus {
 			Original,
 			Replaced,
@@ -523,34 +523,6 @@ namespace Terminal.Gui {
 			Added
 		}
 
-		public class HistoryTextItem {
-			public List<List<Rune>> Lines;
-			public Point CursorPosition;
-			public LineStatus LineStatus;
-			public bool IsUndoing;
-			public Point FinalCursorPosition;
-			public HistoryTextItem RemovedOnAdded;
-
-			public HistoryTextItem (List<List<Rune>> lines, Point curPos, LineStatus linesStatus)
-			{
-				Lines = lines;
-				CursorPosition = curPos;
-				LineStatus = linesStatus;
-			}
-
-			public HistoryTextItem (HistoryTextItem historyTextItem)
-			{
-				Lines = new List<List<Rune>> (historyTextItem.Lines);
-				CursorPosition = new Point (historyTextItem.CursorPosition.X, historyTextItem.CursorPosition.Y);
-				LineStatus = historyTextItem.LineStatus;
-			}
-
-			public override string ToString ()
-			{
-				return $"(Count: {Lines.Count}, Cursor: {CursorPosition}, Status: {LineStatus})";
-			}
-		}
-
 		List<HistoryTextItem> historyTextItems = new List<HistoryTextItem> ();
 		int idxHistoryText = -1;
 		ustring originalText;
@@ -559,7 +531,7 @@ namespace Terminal.Gui {
 
 		public bool HasHistoryChanges => idxHistoryText > -1;
 
-		public event Action<HistoryTextItem> ChangeText;
+		public event EventHandler<HistoryTextItem> ChangeText;
 
 		public void Add (List<List<Rune>> lines, Point curPos, LineStatus lineStatus = LineStatus.Original)
 		{
@@ -711,7 +683,7 @@ namespace Terminal.Gui {
 
 		void OnChangeText (HistoryTextItem lines)
 		{
-			ChangeText?.Invoke (lines);
+			ChangeText?.Invoke (this, lines);
 		}
 
 		public void Clear (ustring text)
@@ -1129,7 +1101,7 @@ namespace Terminal.Gui {
 	///   </item>
 	///  </list>
 	/// </remarks>
-	public class TextView : View {
+	public partial class TextView : View {
 		TextModel model = new TextModel ();
 		int topRow;
 		int leftColumn;
@@ -1156,7 +1128,7 @@ namespace Terminal.Gui {
 		/// set, not as the user types. To be notified as the user changes the contents of the TextView
 		/// see <see cref="IsDirty"/>.
 		/// </remarks>
-		public event Action TextChanged;
+		public event EventHandler TextChanged;
 
 		/// <summary>
 		///  Raised when the contents of the <see cref="TextView"/> are changed. 
@@ -1165,12 +1137,12 @@ namespace Terminal.Gui {
 		/// Unlike the <see cref="TextChanged"/> event, this event is raised whenever the user types or
 		/// otherwise changes the contents of the <see cref="TextView"/>.
 		/// </remarks>
-		public event Action<ContentsChangedEventArgs> ContentsChanged;
+		public event EventHandler<ContentsChangedEventArgs> ContentsChanged;
 
 		/// <summary>
 		/// Invoked with the unwrapped <see cref="CursorPosition"/>.
 		/// </summary>
-		public event Action<Point> UnwrappedCursorPosition;
+		public event EventHandler<PointEventArgs> UnwrappedCursorPosition;
 
 		/// <summary>
 		/// Provides autocomplete context menu based on suggestions at the current cursor
@@ -1378,12 +1350,12 @@ namespace Terminal.Gui {
 				});
 		}
 
-		private void ContextMenu_KeyChanged (Key obj)
+		private void ContextMenu_KeyChanged (object sender, KeyChangedEventArgs e)
 		{
-			ReplaceKeyBinding (obj, ContextMenu.Key);
+			ReplaceKeyBinding (e.OldKey, e.NewKey);
 		}
 
-		private void Model_LinesLoaded ()
+		private void Model_LinesLoaded (object sender, EventArgs e)
 		{
 			// This call is not needed. Model_LinesLoaded gets invoked when
 			// model.LoadString (value) is called. LoadString is called from one place
@@ -1393,7 +1365,7 @@ namespace Terminal.Gui {
 			//historyText.Clear (Text);
 		}
 
-		private void HistoryText_ChangeText (HistoryText.HistoryTextItem obj)
+		private void HistoryText_ChangeText (object sender, HistoryText.HistoryTextItem obj)
 		{
 			SetWrapModel ();
 
@@ -1446,14 +1418,14 @@ namespace Terminal.Gui {
 			OnContentsChanged ();
 		}
 
-		void Top_AlternateBackwardKeyChanged (Key obj)
+		void Top_AlternateBackwardKeyChanged (object sender, KeyChangedEventArgs e)
 		{
-			ReplaceKeyBinding (obj, Application.AlternateBackwardKey);
+			ReplaceKeyBinding (e.OldKey, e.NewKey);
 		}
 
-		void Top_AlternateForwardKeyChanged (Key obj)
+		void Top_AlternateForwardKeyChanged (object sender, KeyChangedEventArgs e)
 		{
-			ReplaceKeyBinding (obj, Application.AlternateForwardKey);
+			ReplaceKeyBinding (e.OldKey, e.NewKey);
 		}
 
 		/// <summary>
@@ -1492,7 +1464,7 @@ namespace Terminal.Gui {
 					wrapManager = new WordWrapManager (model);
 					model = wrapManager.WrapModel (frameWidth, out _, out _, out _, out _);
 				}
-				TextChanged?.Invoke ();
+				TextChanged?.Invoke (this, EventArgs.Empty);
 				SetNeedsDisplay ();
 
 				historyText.Clear (Text);
@@ -2364,7 +2336,7 @@ namespace Terminal.Gui {
 				row = wrapManager.GetModelLineFromWrappedLines (currentRow);
 				col = wrapManager.GetModelColFromWrappedLines (currentRow, currentColumn);
 			}
-			UnwrappedCursorPosition?.Invoke (new Point ((int)col, (int)row));
+			UnwrappedCursorPosition?.Invoke (this, new PointEventArgs(new Point ((int)col, (int)row)));
 		}
 
 		ustring GetSelectedRegion ()
@@ -2709,40 +2681,13 @@ namespace Terminal.Gui {
 			OnUnwrappedCursorPosition ();
 		}
 
-		/// <summary>
-		/// Event arguments for events for when the contents of the TextView change. E.g. the <see cref="ContentsChanged"/> event.
-		/// </summary>
-		public class ContentsChangedEventArgs : EventArgs {
-			/// <summary>
-			/// Creates a new <see cref="ContentsChanged"/> instance.
-			/// </summary>
-			/// <param name="currentRow">Contains the row where the change occurred.</param>
-			/// <param name="currentColumn">Contains the column where the change occured.</param>
-			public ContentsChangedEventArgs (int currentRow, int currentColumn)
-			{
-				Row = currentRow;
-				Col = currentColumn;
-			}
-
-			/// <summary>
-			/// 
-			/// Contains the row where the change occurred.
-			/// </summary>
-			public int Row { get; private set; }
-
-			/// <summary>
-			/// Contains the column where the change occurred.
-			/// </summary>
-			public int Col { get; private set; }
-		}
-
 		/// <summary>
 		/// Called when the contents of the TextView change. E.g. when the user types text or deletes text. Raises
 		/// the <see cref="ContentsChanged"/> event.
 		/// </summary>
 		public virtual void OnContentsChanged ()
 		{
-			ContentsChanged?.Invoke (new ContentsChangedEventArgs (CurrentRow, CurrentColumn));
+			ContentsChanged?.Invoke (this, new ContentsChangedEventArgs (CurrentRow, CurrentColumn));
 		}
 
 		(int width, int height) OffSetBackground ()

+ 7 - 73
Terminal.Gui/Views/TileView.cs

@@ -10,7 +10,7 @@ namespace Terminal.Gui {
 	/// A <see cref="View"/> consisting of a moveable bar that divides
 	/// the display area into resizeable <see cref="Tiles"/>.
 	/// </summary>
-	public class TileView : View {
+	public partial class TileView : View {
 		TileView parentTileView;
 
 		/// <summary>
@@ -24,7 +24,7 @@ namespace Terminal.Gui {
 		/// new instances use <see cref="TileView.RebuildForTileCount(int)"/> 
 		/// or <see cref="TileView.InsertTile(int)"/>.
 		/// </summary>
-		public class Tile {
+		public partial class Tile {
 			/// <summary>
 			/// The <see cref="ContentView"/> that is contained in this <see cref="TileView"/>.
 			/// Add new child views to this member for multiple 
@@ -61,37 +61,6 @@ namespace Terminal.Gui {
 
 			private string _title = string.Empty;
 
-			/// <summary>
-			/// An <see cref="EventArgs"/> which allows passing a cancelable new <see cref="Title"/> value event.
-			/// </summary>
-			public class TitleEventArgs : EventArgs {
-				/// <summary>
-				/// The new Window Title.
-				/// </summary>
-				public ustring NewTitle { get; set; }
-
-				/// <summary>
-				/// The old Window Title.
-				/// </summary>
-				public ustring OldTitle { get; set; }
-
-				/// <summary>
-				/// Flag which allows cancelling the Title change.
-				/// </summary>
-				public bool Cancel { get; set; }
-
-				/// <summary>
-				/// Initializes a new instance of <see cref="TitleEventArgs"/>
-				/// </summary>
-				/// <param name="oldTitle">The <see cref="Title"/> that is/has been replaced.</param>
-				/// <param name="newTitle">The new <see cref="Title"/> to be replaced.</param>
-				public TitleEventArgs (ustring oldTitle, ustring newTitle)
-				{
-					OldTitle = oldTitle;
-					NewTitle = newTitle;
-				}
-			}
-
 			/// <summary>
 			/// Called before the <see cref="Title"/> changes. Invokes the <see cref="TitleChanging"/> event, which can be cancelled.
 			/// </summary>
@@ -101,7 +70,7 @@ namespace Terminal.Gui {
 			public virtual bool OnTitleChanging (ustring oldTitle, ustring newTitle)
 			{
 				var args = new TitleEventArgs (oldTitle, newTitle);
-				TitleChanging?.Invoke (args);
+				TitleChanging?.Invoke (this, args);
 				return args.Cancel;
 			}
 
@@ -109,7 +78,7 @@ namespace Terminal.Gui {
 			/// Event fired when the <see cref="Title"/> is changing. Set <see cref="TitleEventArgs.Cancel"/> to 
 			/// <c>true</c> to cancel the Title change.
 			/// </summary>
-			public event Action<TitleEventArgs> TitleChanging;
+			public event EventHandler<TitleEventArgs> TitleChanging;
 
 			/// <summary>
 			/// Called when the <see cref="Title"/> has been changed. Invokes the <see cref="TitleChanged"/> event.
@@ -119,13 +88,13 @@ namespace Terminal.Gui {
 			public virtual void OnTitleChanged (ustring oldTitle, ustring newTitle)
 			{
 				var args = new TitleEventArgs (oldTitle, newTitle);
-				TitleChanged?.Invoke (args);
+				TitleChanged?.Invoke (this, args);
 			}
 
 			/// <summary>
 			/// Event fired after the <see cref="Title"/> has been changed. 
 			/// </summary>
-			public event Action<TitleEventArgs> TitleChanged;
+			public event EventHandler<TitleEventArgs> TitleChanged;
 
 			/// <summary>
 			/// Creates a new instance of the <see cref="Tile"/> class.
@@ -233,7 +202,7 @@ namespace Terminal.Gui {
 				var tile = new Tile ();
 				tiles.Add (tile);
 				Add (tile.ContentView);
-				tile.TitleChanged += (e) => SetNeedsDisplay ();
+				tile.TitleChanged += (s,e) => SetNeedsDisplay ();
 			}
 
 			LayoutSubviews ();
@@ -1107,41 +1076,6 @@ namespace Terminal.Gui {
 
 	}
 
-	/// <summary>
-	/// Provides data for <see cref="TileView"/> events.
-	/// </summary>
-	public class SplitterEventArgs : EventArgs {
-
-		/// <summary>
-		/// Creates a new instance of the <see cref="SplitterEventArgs"/> class.
-		/// </summary>
-		/// <param name="tileView"><see cref="TileView"/> in which splitter is being moved.</param>
-		/// <param name="idx">Index of the splitter being moved in <see cref="TileView.SplitterDistances"/>.</param>
-		/// <param name="splitterDistance">The new <see cref="Pos"/> of the splitter line.</param>
-		public SplitterEventArgs (TileView tileView, int idx, Pos splitterDistance)
-		{
-			SplitterDistance = splitterDistance;
-			TileView = tileView;
-			Idx = idx;
-		}
-
-		/// <summary>
-		/// New position of the splitter line (see <see cref="TileView.SplitterDistances"/>).
-		/// </summary>
-		public Pos SplitterDistance { get; }
-
-		/// <summary>
-		/// Container (sender) of the event.
-		/// </summary>
-		public TileView TileView { get; }
-
-		/// <summary>
-		/// Gets the index of the splitter that is being moved. This can be
-		/// used to index <see cref="TileView.SplitterDistances"/>
-		/// </summary>
-		public int Idx { get; }
-	}
-
 	/// <summary>
 	/// Represents a method that will handle splitter events.
 	/// </summary>

+ 5 - 5
Terminal.Gui/Views/TimeField.cs

@@ -38,7 +38,7 @@ namespace Terminal.Gui {
 		/// <remarks>
 		///   The passed <see cref="EventArgs"/> is a <see cref="DateTimeEventArgs{T}"/> containing the old value, new value, and format string.
 		/// </remarks>
-		public event Action<DateTimeEventArgs<TimeSpan>> TimeChanged;
+		public event EventHandler<DateTimeEventArgs<TimeSpan>> TimeChanged;
 
 		/// <summary>
 		///    Initializes a new instance of <see cref="TimeField"/> using <see cref="LayoutStyle.Absolute"/> positioning.
@@ -106,13 +106,13 @@ namespace Terminal.Gui {
 			AddKeyBinding (Key.F | Key.CtrlMask, Command.Right);
 		}
 
-		void TextField_TextChanged (ustring e)
+		void TextField_TextChanged (object sender, TextChangedEventArgs e)
 		{
 			try {
 				if (!TimeSpan.TryParseExact (Text.ToString ().Trim (), format.Trim (), CultureInfo.CurrentCulture, TimeSpanStyles.None, out TimeSpan result))
-					Text = e;
+					Text = e.OldValue;
 			} catch (Exception) {
-				Text = e;
+				Text = e.OldValue;
 			}
 		}
 
@@ -336,7 +336,7 @@ namespace Terminal.Gui {
 		/// <param name="args">The event arguments</param>
 		public virtual void OnTimeChanged (DateTimeEventArgs<TimeSpan> args)
 		{
-			TimeChanged?.Invoke (args);
+			TimeChanged?.Invoke (this,args);
 		}
 	}
 }

+ 42 - 0
Terminal.Gui/Views/TitleEventArgs.cs

@@ -0,0 +1,42 @@
+using NStack;
+using System;
+
+namespace Terminal.Gui {
+
+	public partial class TileView {
+
+		public partial class Tile {
+			/// <summary>
+			/// An <see cref="EventArgs"/> which allows passing a cancelable new <see cref="Title"/> value event.
+			/// </summary>
+			public class TitleEventArgs : EventArgs {
+				/// <summary>
+				/// The new Window Title.
+				/// </summary>
+				public ustring NewTitle { get; set; }
+
+				/// <summary>
+				/// The old Window Title.
+				/// </summary>
+				public ustring OldTitle { get; set; }
+
+				/// <summary>
+				/// Flag which allows cancelling the Title change.
+				/// </summary>
+				public bool Cancel { get; set; }
+
+				/// <summary>
+				/// Initializes a new instance of <see cref="TitleEventArgs"/>
+				/// </summary>
+				/// <param name="oldTitle">The <see cref="Title"/> that is/has been replaced.</param>
+				/// <param name="newTitle">The new <see cref="Title"/> to be replaced.</param>
+				public TitleEventArgs (ustring oldTitle, ustring newTitle)
+				{
+					OldTitle = oldTitle;
+					NewTitle = newTitle;
+				}
+			}
+		}
+
+	}
+}

+ 2 - 2
Terminal.Gui/Views/TreeView.cs

@@ -112,7 +112,7 @@ namespace Terminal.Gui {
 		/// This event is raised when an object is activated e.g. by double clicking or 
 		/// pressing <see cref="ObjectActivationKey"/>.
 		/// </summary>
-		public event Action<ObjectActivatedEventArgs<T>> ObjectActivated;
+		public event EventHandler<ObjectActivatedEventArgs<T>> ObjectActivated;
 
 		/// <summary>
 		/// Key which when pressed triggers <see cref="TreeView{T}.ObjectActivated"/>.
@@ -712,7 +712,7 @@ namespace Terminal.Gui {
 		/// <param name="e"></param>
 		protected virtual void OnObjectActivated (ObjectActivatedEventArgs<T> e)
 		{
-			ObjectActivated?.Invoke (e);
+			ObjectActivated?.Invoke (this,e);
 		}
 
 		/// <summary>

+ 1 - 1
Terminal.Gui/Windows/Dialog.cs

@@ -88,7 +88,7 @@ namespace Terminal.Gui {
 				}
 			}
 
-			LayoutStarted += (args) => {
+			LayoutStarted += (s, args) => {
 				LayoutStartedHandler ();
 			};
 		}

+ 6 - 6
Terminal.Gui/Windows/FileDialog.cs

@@ -649,7 +649,7 @@ namespace Terminal.Gui {
 				Y = 1 + msgLines,
 				Width = Dim.Fill () - 1,
 			};
-			dirEntry.TextChanged += (e) => {
+			dirEntry.TextChanged += (s, e) => {
 				DirectoryPath = dirEntry.Text;
 				nameEntry.Text = ustring.Empty;
 			};
@@ -678,7 +678,7 @@ namespace Terminal.Gui {
 				HideDropdownListOnClick = true
 			};
 			cmbAllowedTypes.SetSource (allowedTypes ?? new List<string> ());
-			cmbAllowedTypes.OpenSelectedItem += (e) => {
+			cmbAllowedTypes.OpenSelectedItem += (s, e) => {
 				dirListView.AllowedFileTypes = cmbAllowedTypes.Text.ToString ().Split (';');
 				dirListView.Reload ();
 			};
@@ -698,7 +698,7 @@ namespace Terminal.Gui {
 			dirListView.FileChanged = (file) => nameEntry.Text = file == ".." ? "" : file;
 			dirListView.SelectedChanged = (file) => nameEntry.Text = file.Item1 == ".." ? "" : file.Item1;
 			this.cancel = new Button ("Cancel");
-			this.cancel.Clicked += () => {
+			this.cancel.Clicked += (s,e) => {
 				Cancel ();
 			};
 			AddButton (cancel);
@@ -707,7 +707,7 @@ namespace Terminal.Gui {
 				IsDefault = true,
 				Enabled = nameEntry.Text.IsEmpty ? false : true
 			};
-			this.prompt.Clicked += () => {
+			this.prompt.Clicked += (s,e) => {
 				if (this is OpenDialog) {
 					if (!dirListView.GetValidFilesName (nameEntry.Text.ToString (), out string res)) {
 						nameEntry.Text = res;
@@ -731,7 +731,7 @@ namespace Terminal.Gui {
 			};
 			AddButton (this.prompt);
 
-			nameEntry.TextChanged += (e) => {
+			nameEntry.TextChanged += (s,e) => {
 				if (nameEntry.Text.IsEmpty) {
 					this.prompt.Enabled = false;
 				} else {
@@ -745,7 +745,7 @@ namespace Terminal.Gui {
 			// On success, we will set this to false.
 			canceled = true;
 
-			KeyPress += (e) => {
+			KeyPress += (s, e) => {
 				if (e.KeyEvent.Key == Key.Esc) {
 					Cancel ();
 					e.Handled = true;

+ 1 - 1
Terminal.Gui/Windows/MessageBox.cs

@@ -326,7 +326,7 @@ namespace Terminal.Gui {
 			for (int n = 0; n < buttonList.Count; n++) {
 				int buttonId = n;
 				var b = buttonList [n];
-				b.Clicked += () => {
+				b.Clicked += (s,e) => {
 					Clicked = buttonId;
 					Application.RequestStop ();
 				};

+ 28 - 78
Terminal.Gui/Windows/Wizard.cs

@@ -132,7 +132,7 @@ namespace Terminal.Gui {
 			public virtual bool OnTitleChanging (ustring oldTitle, ustring newTitle)
 			{
 				var args = new TitleEventArgs (oldTitle, newTitle);
-				TitleChanging?.Invoke (args);
+				TitleChanging?.Invoke (this, args);
 				return args.Cancel;
 			}
 
@@ -140,7 +140,7 @@ namespace Terminal.Gui {
 			/// Event fired when the <see cref="Title"/> is changing. Set <see cref="TitleEventArgs.Cancel"/> to 
 			/// <c>true</c> to cancel the Title change.
 			/// </summary>
-			public event Action<TitleEventArgs> TitleChanging;
+			public event EventHandler<TitleEventArgs> TitleChanging;
 
 			/// <summary>
 			/// Called when the <see cref="Title"/> has been changed. Invokes the <see cref="TitleChanged"/> event.
@@ -150,13 +150,13 @@ namespace Terminal.Gui {
 			public virtual void OnTitleChanged (ustring oldTitle, ustring newTitle)
 			{
 				var args = new TitleEventArgs (oldTitle, newTitle);
-				TitleChanged?.Invoke (args);
+				TitleChanged?.Invoke (this, args);
 			}
 
 			/// <summary>
 			/// Event fired after the <see cref="Title"/> has been changed. 
 			/// </summary>
-			public event Action<TitleEventArgs> TitleChanged;
+			public event EventHandler<TitleEventArgs> TitleChanged;
 
 			// The contentView works like the ContentView in FrameView.
 			private View contentView = new View () { Data = "WizardContentView" };
@@ -211,7 +211,7 @@ namespace Terminal.Gui {
 
 				var scrollBar = new ScrollBarView (helpTextView, true);
 
-				scrollBar.ChangedPosition += () => {
+				scrollBar.ChangedPosition += (s,e) => {
 					helpTextView.TopRow = scrollBar.Position;
 					if (helpTextView.TopRow != scrollBar.Position) {
 						scrollBar.Position = helpTextView.TopRow;
@@ -219,7 +219,7 @@ namespace Terminal.Gui {
 					helpTextView.SetNeedsDisplay ();
 				};
 
-				scrollBar.OtherScrollBarView.ChangedPosition += () => {
+				scrollBar.OtherScrollBarView.ChangedPosition += (s,e) => {
 					helpTextView.LeftColumn = scrollBar.OtherScrollBarView.Position;
 					if (helpTextView.LeftColumn != scrollBar.OtherScrollBarView.Position) {
 						scrollBar.OtherScrollBarView.Position = helpTextView.LeftColumn;
@@ -227,7 +227,7 @@ namespace Terminal.Gui {
 					helpTextView.SetNeedsDisplay ();
 				};
 
-				scrollBar.VisibleChanged += () => {
+				scrollBar.VisibleChanged += (s,e) => {
 					if (scrollBar.Visible && helpTextView.RightOffset == 0) {
 						helpTextView.RightOffset = 1;
 					} else if (!scrollBar.Visible && helpTextView.RightOffset == 1) {
@@ -235,7 +235,7 @@ namespace Terminal.Gui {
 					}
 				};
 
-				scrollBar.OtherScrollBarView.VisibleChanged += () => {
+				scrollBar.OtherScrollBarView.VisibleChanged += (s,e) => {
 					if (scrollBar.OtherScrollBarView.Visible && helpTextView.BottomOffset == 0) {
 						helpTextView.BottomOffset = 1;
 					} else if (!scrollBar.OtherScrollBarView.Visible && helpTextView.BottomOffset == 1) {
@@ -243,7 +243,7 @@ namespace Terminal.Gui {
 					}
 				};
 
-				helpTextView.DrawContent += (e) => {
+				helpTextView.DrawContent += (s,e) => {
 					scrollBar.Size = helpTextView.Lines;
 					scrollBar.Position = helpTextView.TopRow;
 					if (scrollBar.OtherScrollBarView != null) {
@@ -385,26 +385,26 @@ namespace Terminal.Gui {
 
 		}
 
-		private void Wizard_Loaded ()
+		private void Wizard_Loaded (object sender, EventArgs args)
 		{
 			CurrentStep = GetFirstStep (); // gets the first step if CurrentStep == null
 		}
 
 		private bool finishedPressed = false;
 
-		private void Wizard_Closing (ToplevelClosingEventArgs obj)
+		private void Wizard_Closing (object sender, ToplevelClosingEventArgs obj)
 		{
 			if (!finishedPressed) {
 				var args = new WizardButtonEventArgs ();
-				Cancelled?.Invoke (args);
+				Cancelled?.Invoke (this, args);
 			}
 		}
 
-		private void NextfinishBtn_Clicked ()
+		private void NextfinishBtn_Clicked (object sender, EventArgs e)
 		{
 			if (CurrentStep == GetLastStep ()) {
 				var args = new WizardButtonEventArgs ();
-				Finished?.Invoke (args);
+				Finished?.Invoke (this, args);
 				if (!args.Cancel) {
 					finishedPressed = true;
 					if (IsCurrentTop) {
@@ -416,7 +416,7 @@ namespace Terminal.Gui {
 				}
 			} else {
 				var args = new WizardButtonEventArgs ();
-				MovingNext?.Invoke (args);
+				MovingNext?.Invoke (this, args);
 				if (!args.Cancel) {
 					GoNext ();
 				}
@@ -437,7 +437,7 @@ namespace Terminal.Gui {
 				switch (kb.Key) {
 				case Key.Esc:
 					var args = new WizardButtonEventArgs ();
-					Cancelled?.Invoke (args);
+					Cancelled?.Invoke (this, args);
 					return false;
 				}
 			}
@@ -486,10 +486,10 @@ namespace Terminal.Gui {
 			return null;
 		}
 
-		private void BackBtn_Clicked ()
+		private void BackBtn_Clicked (object sender, EventArgs e)
 		{
 			var args = new WizardButtonEventArgs ();
-			MovingBack?.Invoke (args);
+			MovingBack?.Invoke (this, args);
 			if (!args.Cancel) {
 				GoBack ();
 			}
@@ -590,8 +590,8 @@ namespace Terminal.Gui {
 		{
 			SizeStep (newStep);
 
-			newStep.EnabledChanged += UpdateButtonsAndTitle;
-			newStep.TitleChanged += (args) => UpdateButtonsAndTitle ();
+			newStep.EnabledChanged += (s,e)=> UpdateButtonsAndTitle();
+			newStep.TitleChanged += (s,e) => UpdateButtonsAndTitle ();
 			steps.AddLast (newStep);
 			this.Add (newStep);
 			UpdateButtonsAndTitle ();
@@ -615,29 +615,11 @@ namespace Terminal.Gui {
 		}
 		private ustring wizardTitle = ustring.Empty;
 
-		/// <summary>	
-		/// <see cref="EventArgs"/> for <see cref="WizardStep"/> transition events.
-		/// </summary>
-		public class WizardButtonEventArgs : EventArgs {
-			/// <summary>
-			/// Set to true to cancel the transition to the next step.
-			/// </summary>
-			public bool Cancel { get; set; }
-
-			/// <summary>
-			/// Initializes a new instance of <see cref="WizardButtonEventArgs"/>
-			/// </summary>
-			public WizardButtonEventArgs ()
-			{
-				Cancel = false;
-			}
-		}
-
 		/// <summary>
 		/// Raised when the Back button in the <see cref="Wizard"/> is clicked. The Back button is always
 		/// the first button in the array of Buttons passed to the <see cref="Wizard"/> constructor, if any.
 		/// </summary>
-		public event Action<WizardButtonEventArgs> MovingBack;
+		public event EventHandler<WizardButtonEventArgs> MovingBack;
 
 		/// <summary>
 		/// Raised when the Next/Finish button in the <see cref="Wizard"/> is clicked (or the user presses Enter). 
@@ -645,7 +627,7 @@ namespace Terminal.Gui {
 		/// if any. This event is only raised if the <see cref="CurrentStep"/> is the last Step in the Wizard flow 
 		/// (otherwise the <see cref="Finished"/> event is raised).
 		/// </summary>
-		public event Action<WizardButtonEventArgs> MovingNext;
+		public event EventHandler<WizardButtonEventArgs> MovingNext;
 
 		/// <summary>
 		/// Raised when the Next/Finish button in the <see cref="Wizard"/> is clicked. The Next/Finish button is always
@@ -653,7 +635,7 @@ namespace Terminal.Gui {
 		/// raised if the <see cref="CurrentStep"/> is the last Step in the Wizard flow 
 		/// (otherwise the <see cref="Finished"/> event is raised).
 		/// </summary>
-		public event Action<WizardButtonEventArgs> Finished;
+		public event EventHandler<WizardButtonEventArgs> Finished;
 
 		/// <summary>
 		/// Raised when the user has cancelled the <see cref="Wizard"/> by pressin the Esc key. 
@@ -661,50 +643,18 @@ namespace Terminal.Gui {
 		/// closing, cancel the event by setting <see cref="WizardButtonEventArgs.Cancel"/> to 
 		/// <c>true</c> before returning from the event handler.
 		/// </summary>
-		public event Action<WizardButtonEventArgs> Cancelled;
-
-		/// <summary>
-		/// <see cref="EventArgs"/> for <see cref="WizardStep"/> events.
-		/// </summary>
-		public class StepChangeEventArgs : EventArgs {
-			/// <summary>
-			/// The current (or previous) <see cref="WizardStep"/>.
-			/// </summary>
-			public WizardStep OldStep { get; }
-
-			/// <summary>
-			/// The <see cref="WizardStep"/> the <see cref="Wizard"/> is changing to or has changed to.
-			/// </summary>
-			public WizardStep NewStep { get; }
-
-			/// <summary>
-			/// Event handlers can set to true before returning to cancel the step transition.
-			/// </summary>
-			public bool Cancel { get; set; }
-
-			/// <summary>
-			/// Initializes a new instance of <see cref="StepChangeEventArgs"/>
-			/// </summary>
-			/// <param name="oldStep">The current <see cref="WizardStep"/>.</param>
-			/// <param name="newStep">The new <see cref="WizardStep"/>.</param>
-			public StepChangeEventArgs (WizardStep oldStep, WizardStep newStep)
-			{
-				OldStep = oldStep;
-				NewStep = newStep;
-				Cancel = false;
-			}
-		}
+		public event EventHandler<WizardButtonEventArgs> Cancelled;
 
 		/// <summary>
 		/// This event is raised when the current <see cref="CurrentStep"/>) is about to change. Use <see cref="StepChangeEventArgs.Cancel"/> 
 		/// to abort the transition.
 		/// </summary>
-		public event Action<StepChangeEventArgs> StepChanging;
+		public event EventHandler<StepChangeEventArgs> StepChanging;
 
 		/// <summary>
 		/// This event is raised after the <see cref="Wizard"/> has changed the <see cref="CurrentStep"/>. 
 		/// </summary>
-		public event Action<StepChangeEventArgs> StepChanged;
+		public event EventHandler<StepChangeEventArgs> StepChanged;
 
 		/// <summary>
 		/// Gets or sets the currently active <see cref="WizardStep"/>.
@@ -725,7 +675,7 @@ namespace Terminal.Gui {
 		public virtual bool OnStepChanging (WizardStep oldStep, WizardStep newStep)
 		{
 			var args = new StepChangeEventArgs (oldStep, newStep);
-			StepChanging?.Invoke (args);
+			StepChanging?.Invoke (this, args);
 			return args.Cancel;
 		}
 
@@ -738,7 +688,7 @@ namespace Terminal.Gui {
 		public virtual bool OnStepChanged (WizardStep oldStep, WizardStep newStep)
 		{
 			var args = new StepChangeEventArgs (oldStep, newStep);
-			StepChanged?.Invoke (args);
+			StepChanged?.Invoke (this, args);
 			return args.Cancel;
 		}
 

+ 54 - 0
Terminal.Gui/Windows/WizardEventArgs.cs

@@ -0,0 +1,54 @@
+using System;
+using static Terminal.Gui.Wizard;
+
+namespace Terminal.Gui {
+	/// <summary>
+	/// <see cref="EventArgs"/> for <see cref="WizardStep"/> transition events.
+	/// </summary>
+	public class WizardButtonEventArgs : EventArgs {
+		/// <summary>
+		/// Set to true to cancel the transition to the next step.
+		/// </summary>
+		public bool Cancel { get; set; }
+
+		/// <summary>
+		/// Initializes a new instance of <see cref="WizardButtonEventArgs"/>
+		/// </summary>
+		public WizardButtonEventArgs ()
+		{
+			Cancel = false;
+		}
+	}
+
+	/// <summary>
+	/// <see cref="EventArgs"/> for <see cref="WizardStep"/> events.
+	/// </summary>
+	public class StepChangeEventArgs : EventArgs {
+		/// <summary>
+		/// The current (or previous) <see cref="WizardStep"/>.
+		/// </summary>
+		public WizardStep OldStep { get; }
+
+		/// <summary>
+		/// The <see cref="WizardStep"/> the <see cref="Wizard"/> is changing to or has changed to.
+		/// </summary>
+		public WizardStep NewStep { get; }
+
+		/// <summary>
+		/// Event handlers can set to true before returning to cancel the step transition.
+		/// </summary>
+		public bool Cancel { get; set; }
+
+		/// <summary>
+		/// Initializes a new instance of <see cref="StepChangeEventArgs"/>
+		/// </summary>
+		/// <param name="oldStep">The current <see cref="WizardStep"/>.</param>
+		/// <param name="newStep">The new <see cref="WizardStep"/>.</param>
+		public StepChangeEventArgs (WizardStep oldStep, WizardStep newStep)
+		{
+			OldStep = oldStep;
+			NewStep = newStep;
+			Cancel = false;
+		}
+	}
+}

+ 9 - 6
UICatalog/KeyBindingsDialog.cs

@@ -60,8 +60,11 @@ namespace UICatalog {
 				foreach (var sub in view.Subviews) {
 					RecordView (sub);
 				}
+				// TODO: BUG: Based on my new understanding of Added event I think this is wrong
+				// (and always was wrong). Parents don't get to be told when new views are added
+				// to them
 
-				view.Added += RecordView;
+				view.Added += (s,e)=>RecordView(e.Child);
 			}
 
 			internal static void Initialize ()
@@ -151,14 +154,14 @@ namespace UICatalog {
 			btnChange.Clicked += RemapKey;
 
 			var close = new Button ("Ok");
-			close.Clicked += () => {
+			close.Clicked += (s,e) => {
 				Application.RequestStop ();
 				ViewTracker.Instance.StartUsingNewKeyMap (CurrentBindings);
 			};
 			AddButton (close);
 
 			var cancel = new Button ("Cancel");
-			cancel.Clicked += ()=>Application.RequestStop();
+			cancel.Clicked += (s,e)=>Application.RequestStop();
 			AddButton (cancel);
 
 			// Register event handler as the last thing in constructor to prevent early calls
@@ -169,14 +172,14 @@ namespace UICatalog {
 			SetTextBoxToShowBinding (commands.First());
 		}
 
-		private void RemapKey ()
+		private void RemapKey (object sender, EventArgs e)
 		{
 			var cmd = commands [commandsListView.SelectedItem];
 			Key? key = null;
 
 			// prompt user to hit a key
 			var dlg = new Dialog ("Enter Key");
-			dlg.KeyPress += (k) => {
+			dlg.KeyPress += (s, k) => {
 				key = k.KeyEvent.Key;
 				Application.RequestStop ();
 			};
@@ -198,7 +201,7 @@ namespace UICatalog {
 			SetNeedsDisplay ();
 		}
 
-		private void CommandsListView_SelectedItemChanged (ListViewItemEventArgs obj)
+		private void CommandsListView_SelectedItemChanged (object sender, ListViewItemEventArgs obj)
 		{
 			SetTextBoxToShowBinding ((Command)obj.Value);
 		}

+ 4 - 4
UICatalog/Scenarios/ASCIICustomButton.cs

@@ -107,7 +107,7 @@ namespace UICatalog.Scenarios {
 				Add (border, fill, title);
 			}
 
-			private void This_MouseClick (MouseEventArgs obj)
+			private void This_MouseClick (object sender, MouseEventEventArgs obj)
 			{
 				OnMouseEvent (obj.MouseEvent);
 			}
@@ -231,7 +231,7 @@ namespace UICatalog.Scenarios {
 				}
 			}
 
-			private void Button_KeyPress (KeyEventEventArgs obj)
+			private void Button_KeyPress (object sender, KeyEventEventArgs obj)
 			{
 				switch (obj.KeyEvent.Key) {
 				case Key.End:
@@ -259,7 +259,7 @@ namespace UICatalog.Scenarios {
 				}
 			}
 
-			private void Button_MouseClick (MouseEventArgs obj)
+			private void Button_MouseClick (object sender, MouseEventEventArgs obj)
 			{
 				if (obj.MouseEvent.Flags == MouseFlags.WheeledDown) {
 					scrollView.ContentOffset = new Point (scrollView.ContentOffset.X,
@@ -272,7 +272,7 @@ namespace UICatalog.Scenarios {
 				}
 			}
 
-			private void Button_Clicked ()
+			private void Button_Clicked (object sender, EventArgs e)
 			{
 				MessageBox.Query ("Button clicked.", $"'{selected.Text}' clicked!", "Ok");
 				if (selected.Text == "Close") {

+ 13 - 13
UICatalog/Scenarios/AllViewsTester.cs

@@ -88,10 +88,10 @@ namespace UICatalog.Scenarios {
 				AllowsMarking = false,
 				ColorScheme = Colors.TopLevel,
 			};
-			_classListView.OpenSelectedItem += (a) => {
+			_classListView.OpenSelectedItem += (s, a) => {
 				_settingsPane.SetFocus ();
 			};
-			_classListView.SelectedItemChanged += (args) => {
+			_classListView.SelectedItemChanged += (s,args) => {
 				ClearClass (_curView);
 				_curView = CreateClass (_viewClasses.Values.ToArray () [_classListView.SelectedItem]);
 			};
@@ -106,9 +106,9 @@ namespace UICatalog.Scenarios {
 				ColorScheme = Colors.TopLevel,
 			};
 			_computedCheckBox = new CheckBox ("Computed Layout", true) { X = 0, Y = 0 };
-			_computedCheckBox.Toggled += (previousState) => {
+			_computedCheckBox.Toggled += (s,e) => {
 				if (_curView != null) {
-					_curView.LayoutStyle = previousState == true ? LayoutStyle.Absolute : LayoutStyle.Computed;
+					_curView.LayoutStyle = e.OldValue == true ? LayoutStyle.Absolute : LayoutStyle.Computed;
 					_hostPane.LayoutSubviews ();
 				}
 			};
@@ -129,9 +129,9 @@ namespace UICatalog.Scenarios {
 				X = 0,
 				Y = Pos.Bottom (label),
 			};
-			_xRadioGroup.SelectedItemChanged += (selected) => DimPosChanged (_curView);
+			_xRadioGroup.SelectedItemChanged += (s, selected) => DimPosChanged (_curView);
 			_xText = new TextField ($"{_xVal}") { X = Pos.Right (label) + 1, Y = 0, Width = 4 };
-			_xText.TextChanged += (args) => {
+			_xText.TextChanged += (s, args) => {
 				try {
 					_xVal = int.Parse (_xText.Text.ToString ());
 					DimPosChanged (_curView);
@@ -147,7 +147,7 @@ namespace UICatalog.Scenarios {
 			label = new Label ("y:") { X = Pos.Right (_xRadioGroup) + 1, Y = 0 };
 			_locationFrame.Add (label);
 			_yText = new TextField ($"{_yVal}") { X = Pos.Right (label) + 1, Y = 0, Width = 4 };
-			_yText.TextChanged += (args) => {
+			_yText.TextChanged += (s,args) => {
 				try {
 					_yVal = int.Parse (_yText.Text.ToString ());
 					DimPosChanged (_curView);
@@ -160,7 +160,7 @@ namespace UICatalog.Scenarios {
 				X = Pos.X (label),
 				Y = Pos.Bottom (label),
 			};
-			_yRadioGroup.SelectedItemChanged += (selected) => DimPosChanged (_curView);
+			_yRadioGroup.SelectedItemChanged += (s, selected) => DimPosChanged (_curView);
 			_locationFrame.Add (_yRadioGroup);
 
 			_sizeFrame = new FrameView ("Size (Dim)") {
@@ -177,9 +177,9 @@ namespace UICatalog.Scenarios {
 				X = 0,
 				Y = Pos.Bottom (label),
 			};
-			_wRadioGroup.SelectedItemChanged += (selected) => DimPosChanged (_curView);
+			_wRadioGroup.SelectedItemChanged += (s, selected) => DimPosChanged (_curView);
 			_wText = new TextField ($"{_wVal}") { X = Pos.Right (label) + 1, Y = 0, Width = 4 };
-			_wText.TextChanged += (args) => {
+			_wText.TextChanged += (s,args) => {
 				try {
 					switch (_wRadioGroup.SelectedItem) {
 					case 0:
@@ -202,7 +202,7 @@ namespace UICatalog.Scenarios {
 			label = new Label ("height:") { X = Pos.Right (_wRadioGroup) + 1, Y = 0 };
 			_sizeFrame.Add (label);
 			_hText = new TextField ($"{_hVal}") { X = Pos.Right (label) + 1, Y = 0, Width = 4 };
-			_hText.TextChanged += (args) => {
+			_hText.TextChanged += (s, args) => {
 				try {
 					switch (_hRadioGroup.SelectedItem) {
 					case 0:
@@ -224,7 +224,7 @@ namespace UICatalog.Scenarios {
 				X = Pos.X (label),
 				Y = Pos.Bottom (label),
 			};
-			_hRadioGroup.SelectedItemChanged += (selected) => DimPosChanged (_curView);
+			_hRadioGroup.SelectedItemChanged += (s, selected) => DimPosChanged (_curView);
 			_sizeFrame.Add (_hRadioGroup);
 
 			_settingsPane.Add (_sizeFrame);
@@ -433,7 +433,7 @@ namespace UICatalog.Scenarios {
 			return view;
 		}
 
-		void LayoutCompleteHandler (View.LayoutEventArgs args)
+		void LayoutCompleteHandler (object sender, LayoutEventArgs args)
 		{
 			UpdateTitle (_curView);
 		}

+ 5 - 5
UICatalog/Scenarios/AutoSizeAndDirectionText.cs

@@ -44,7 +44,7 @@ namespace UICatalog.Scenarios {
 				X = Pos.Center (),
 				Y = Pos.Center () + 3
 			};
-			ckbDirection.Toggled += (_) => {
+			ckbDirection.Toggled += (s,e) => {
 				if (labelH.TextDirection == TextDirection.LeftRight_TopBottom) {
 					labelH.TextDirection = TextDirection.TopBottom_LeftRight;
 					labelV.TextDirection = TextDirection.LeftRight_TopBottom;
@@ -60,7 +60,7 @@ namespace UICatalog.Scenarios {
 				Y = Pos.Center () + 5,
 				Checked = labelH.AutoSize = labelV.AutoSize
 			};
-			ckbAutoSize.Toggled += (_) => labelH.AutoSize = labelV.AutoSize = (bool)ckbAutoSize.Checked;
+			ckbAutoSize.Toggled += (s,e) => labelH.AutoSize = labelV.AutoSize = (bool)ckbAutoSize.Checked;
 			Win.Add (ckbAutoSize);
 
 			var ckbPreserveTrailingSpaces = new CheckBox ("Preserve Trailing Spaces") {
@@ -68,7 +68,7 @@ namespace UICatalog.Scenarios {
 				Y = Pos.Center () + 7,
 				Checked = labelH.PreserveTrailingSpaces = labelV.PreserveTrailingSpaces
 			};
-			ckbPreserveTrailingSpaces.Toggled += (_) =>
+			ckbPreserveTrailingSpaces.Toggled += (s, e) =>
 					labelH.PreserveTrailingSpaces = labelV.PreserveTrailingSpaces = (bool)ckbPreserveTrailingSpaces.Checked;
 			Win.Add (ckbPreserveTrailingSpaces);
 
@@ -76,7 +76,7 @@ namespace UICatalog.Scenarios {
 				X = Pos.Center (),
 				Y = Pos.Center () + 9
 			};
-			ckbWideText.Toggled += (_) => {
+			ckbWideText.Toggled += (s, e) => {
 				if (ckbWideText.Checked == true) {
 					labelH.Text = labelV.Text = editText.Text = wideText;
 					labelH.Width = 14;
@@ -90,7 +90,7 @@ namespace UICatalog.Scenarios {
 			};
 			Win.Add (ckbWideText);
 
-			Win.KeyUp += (_) =>
+			Win.KeyUp += (s,e) =>
 				labelH.Text = labelV.Text = text = editText.Text.ToString ();
 		}
 	}

+ 11 - 11
UICatalog/Scenarios/BackgroundWorkerCollection.cs

@@ -63,13 +63,13 @@ namespace UICatalog.Scenarios {
 				};
 			}
 
-			private void MdiMain_Closed (Toplevel obj)
+			private void MdiMain_Closed (object sender, ToplevelEventArgs e)
 			{
 				workerApp.Dispose ();
 				Dispose ();
 			}
 
-			private void Menu_MenuOpening (MenuOpeningEventArgs menu)
+			private void Menu_MenuOpening (object sender, MenuOpeningEventArgs menu)
 			{
 				if (!canOpenWorkerApp) {
 					canOpenWorkerApp = true;
@@ -82,14 +82,14 @@ namespace UICatalog.Scenarios {
 				}
 			}
 
-			private void MdiMain_Deactivate (Toplevel top)
+			private void MdiMain_Deactivate (object sender, ToplevelEventArgs top)
 			{
-				workerApp.WriteLog ($"{top.Data} deactivate.");
+				workerApp.WriteLog ($"{top.Toplevel.Data} deactivate.");
 			}
 
-			private void MdiMain_Activate (Toplevel top)
+			private void MdiMain_Activate (object sender, ToplevelEventArgs top)
 			{
-				workerApp.WriteLog ($"{top.Data} activate.");
+				workerApp.WriteLog ($"{top.Toplevel.Data} activate.");
 			}
 
 			private MenuBarItem View ()
@@ -328,7 +328,7 @@ namespace UICatalog.Scenarios {
 				Add (listView);
 
 				start = new Button ("Start") { IsDefault = true };
-				start.Clicked += () => {
+				start.Clicked += (s,e) => {
 					Staging = new Staging (DateTime.Now);
 					RequestStop ();
 				};
@@ -338,13 +338,13 @@ namespace UICatalog.Scenarios {
 				close.Clicked += OnReportClosed;
 				Add (close);
 
-				KeyPress += (e) => {
+				KeyPress += (s, e) => {
 					if (e.KeyEvent.Key == Key.Esc) {
-						OnReportClosed ();
+						OnReportClosed (this, EventArgs.Empty);
 					}
 				};
 
-				LayoutStarted += (_) => {
+				LayoutStarted += (s,e) => {
 					var btnsWidth = start.Bounds.Width + close.Bounds.Width + 2 - 1;
 					var shiftLeft = Math.Max ((Bounds.Width - btnsWidth) / 2 - 2, 0);
 
@@ -358,7 +358,7 @@ namespace UICatalog.Scenarios {
 				};
 			}
 
-			private void OnReportClosed ()
+			private void OnReportClosed (object sender, EventArgs e)
 			{
 				if (Staging?.StartStaging != null) {
 					ReportClosed?.Invoke (this);

+ 3 - 3
UICatalog/Scenarios/BordersComparisons.cs

@@ -28,7 +28,7 @@ namespace UICatalog.Scenarios {
 				X = Pos.Center (),
 				Y = Pos.Center (),
 			};
-			button.Clicked += () => MessageBox.Query (20, 7, "Hi", "I'm a Window?", "Yes", "No");
+			button.Clicked += (s,e) => MessageBox.Query (20, 7, "Hi", "I'm a Window?", "Yes", "No");
 			var label = new Label ("I'm a Window") {
 				X = Pos.Center (),
 				Y = Pos.Center () - 1,
@@ -58,7 +58,7 @@ namespace UICatalog.Scenarios {
 				X = Pos.Center (),
 				Y = Pos.Center (),
 			};
-			button2.Clicked += () => MessageBox.Query (20, 7, "Hi", "I'm a Toplevel?", "Yes", "No");
+			button2.Clicked += (s,e) => MessageBox.Query (20, 7, "Hi", "I'm a Toplevel?", "Yes", "No");
 			var label2 = new Label ("I'm a Toplevel") {
 				X = Pos.Center (),
 				Y = Pos.Center () - 1,
@@ -93,7 +93,7 @@ namespace UICatalog.Scenarios {
 				X = Pos.Center (),
 				Y = Pos.Center (),
 			};
-			button3.Clicked += () => MessageBox.Query (20, 7, "Hi", "I'm a FrameView?", "Yes", "No");
+			button3.Clicked += (s,e) => MessageBox.Query (20, 7, "Hi", "I'm a FrameView?", "Yes", "No");
 			var label3 = new Label ("I'm a FrameView") {
 				X = Pos.Center (),
 				Y = Pos.Center () - 1,

+ 18 - 18
UICatalog/Scenarios/BordersOnContainers.cs

@@ -37,7 +37,7 @@ namespace UICatalog.Scenarios {
 				X = Pos.Center (),
 				Y = Pos.Center (),
 			};
-			button.Clicked += () => MessageBox.Query (20, 7, "Hi", $"I'm a {typeName}?", "Yes", "No");
+			button.Clicked += (s, e) => MessageBox.Query (20, 7, "Hi", $"I'm a {typeName}?", "Yes", "No");
 			var label = new Label ($"I'm a {typeName}") {
 				X = Pos.Center (),
 				Y = Pos.Center () - 1,
@@ -64,7 +64,7 @@ namespace UICatalog.Scenarios {
 				Y = 1,
 				Width = 5
 			};
-			paddingTopEdit.TextChanging += (e) => {
+			paddingTopEdit.TextChanging += (s, e) => {
 				try {
 					smartView.Border.PaddingThickness = new Thickness (smartView.Border.PaddingThickness.Left,
 						int.Parse (e.NewText.ToString ()), smartView.Border.PaddingThickness.Right,
@@ -84,7 +84,7 @@ namespace UICatalog.Scenarios {
 				Y = 2,
 				Width = 5
 			};
-			paddingLeftEdit.TextChanging += (e) => {
+			paddingLeftEdit.TextChanging += (s, e) => {
 				try {
 					smartView.Border.PaddingThickness = new Thickness (int.Parse (e.NewText.ToString ()),
 						smartView.Border.PaddingThickness.Top, smartView.Border.PaddingThickness.Right,
@@ -103,7 +103,7 @@ namespace UICatalog.Scenarios {
 				Y = 2,
 				Width = 5
 			};
-			paddingRightEdit.TextChanging += (e) => {
+			paddingRightEdit.TextChanging += (s, e) => {
 				try {
 					smartView.Border.PaddingThickness = new Thickness (smartView.Border.PaddingThickness.Left,
 						smartView.Border.PaddingThickness.Top, int.Parse (e.NewText.ToString ()),
@@ -122,7 +122,7 @@ namespace UICatalog.Scenarios {
 				Y = 3,
 				Width = 5
 			};
-			paddingBottomEdit.TextChanging += (e) => {
+			paddingBottomEdit.TextChanging += (s, e) => {
 				try {
 					smartView.Border.PaddingThickness = new Thickness (smartView.Border.PaddingThickness.Left,
 						smartView.Border.PaddingThickness.Top, smartView.Border.PaddingThickness.Right,
@@ -140,7 +140,7 @@ namespace UICatalog.Scenarios {
 				X = Pos.Left (paddingLeftEdit),
 				Y = 5
 			};
-			replacePadding.Clicked += () => {
+			replacePadding.Clicked += (s, e) => {
 				smartView.Border.PaddingThickness = new Thickness (smartView.Border.PaddingThickness.Top);
 				if (paddingTopEdit.Text.IsEmpty) {
 					paddingTopEdit.Text = "0";
@@ -158,7 +158,7 @@ namespace UICatalog.Scenarios {
 				Y = 1,
 				Width = 5
 			};
-			borderTopEdit.TextChanging += (e) => {
+			borderTopEdit.TextChanging += (s, e) => {
 				try {
 					smartView.Border.BorderThickness = new Thickness (smartView.Border.BorderThickness.Left,
 						int.Parse (e.NewText.ToString ()), smartView.Border.BorderThickness.Right,
@@ -178,7 +178,7 @@ namespace UICatalog.Scenarios {
 				Y = 2,
 				Width = 5
 			};
-			borderLeftEdit.TextChanging += (e) => {
+			borderLeftEdit.TextChanging += (s, e) => {
 				try {
 					smartView.Border.BorderThickness = new Thickness (int.Parse (e.NewText.ToString ()),
 						smartView.Border.BorderThickness.Top, smartView.Border.BorderThickness.Right,
@@ -197,7 +197,7 @@ namespace UICatalog.Scenarios {
 				Y = 2,
 				Width = 5
 			};
-			borderRightEdit.TextChanging += (e) => {
+			borderRightEdit.TextChanging += (s, e) => {
 				try {
 					smartView.Border.BorderThickness = new Thickness (smartView.Border.BorderThickness.Left,
 						smartView.Border.BorderThickness.Top, int.Parse (e.NewText.ToString ()),
@@ -216,7 +216,7 @@ namespace UICatalog.Scenarios {
 				Y = 3,
 				Width = 5
 			};
-			borderBottomEdit.TextChanging += (e) => {
+			borderBottomEdit.TextChanging += (s, e) => {
 				try {
 					smartView.Border.BorderThickness = new Thickness (smartView.Border.BorderThickness.Left,
 						smartView.Border.BorderThickness.Top, smartView.Border.BorderThickness.Right,
@@ -234,7 +234,7 @@ namespace UICatalog.Scenarios {
 				X = Pos.Left (borderLeftEdit),
 				Y = 5
 			};
-			replaceBorder.Clicked += () => {
+			replaceBorder.Clicked += (s, e) => {
 				smartView.Border.BorderThickness = new Thickness (smartView.Border.BorderThickness.Top);
 				if (borderTopEdit.Text.IsEmpty) {
 					borderTopEdit.Text = "0";
@@ -262,7 +262,7 @@ namespace UICatalog.Scenarios {
 				Y = 0,
 				Width = 5
 			};
-			cbDrawMarginFrame.Toggled += (e) => {
+			cbDrawMarginFrame.Toggled += (s, e) => {
 				try {
 					smartView.Border.DrawMarginFrame = (bool)cbDrawMarginFrame.Checked;
 					if (cbDrawMarginFrame.Checked != smartView.Border.DrawMarginFrame) {
@@ -272,7 +272,7 @@ namespace UICatalog.Scenarios {
 			};
 			Add (cbDrawMarginFrame);
 
-			rbBorderStyle.SelectedItemChanged += (e) => {
+			rbBorderStyle.SelectedItemChanged += (s, e) => {
 				smartView.Border.BorderStyle = (BorderStyle)e.SelectedItem;
 				smartView.SetNeedsDisplay ();
 				if (cbDrawMarginFrame.Checked != smartView.Border.DrawMarginFrame) {
@@ -301,7 +301,7 @@ namespace UICatalog.Scenarios {
 				Y = 3,
 				Width = 5
 			};
-			effect3DOffsetX.TextChanging += (e) => {
+			effect3DOffsetX.TextChanging += (s, e) => {
 				try {
 					smartView.Border.Effect3DOffset = new Point (int.Parse (e.NewText.ToString ()),
 						smartView.Border.Effect3DOffset.Y);
@@ -324,7 +324,7 @@ namespace UICatalog.Scenarios {
 				Y = 3,
 				Width = 5
 			};
-			effect3DOffsetY.TextChanging += (e) => {
+			effect3DOffsetY.TextChanging += (s, e) => {
 				try {
 					smartView.Border.Effect3DOffset = new Point (smartView.Border.Effect3DOffset.X,
 						int.Parse (e.NewText.ToString ()));
@@ -337,7 +337,7 @@ namespace UICatalog.Scenarios {
 			effect3DOffsetY.Text = $"{smartView.Border.Effect3DOffset.Y}";
 			Add (effect3DOffsetY);
 
-			cbEffect3D.Toggled += (e) => {
+			cbEffect3D.Toggled += (s, e) => {
 				try {
 					smartView.Border.Effect3D = effect3DOffsetX.Enabled =
 						effect3DOffsetY.Enabled = (bool)cbEffect3D.Checked;
@@ -356,7 +356,7 @@ namespace UICatalog.Scenarios {
 				Y = 6,
 				SelectedItem = (int)smartView.Border.BackgroundColor
 			};
-			rbBackground.SelectedItemChanged += (e) => {
+			rbBackground.SelectedItemChanged += (s, e) => {
 				smartView.Border.BackgroundColor = (Color)e.SelectedItem;
 			};
 			Add (rbBackground);
@@ -373,7 +373,7 @@ namespace UICatalog.Scenarios {
 				Y = 6,
 				SelectedItem = (int)smartView.Border.ForgroundColor
 			};
-			rbBorderBrush.SelectedItemChanged += (e) => {
+			rbBorderBrush.SelectedItemChanged += (s, e) => {
 				smartView.Border.ForgroundColor = (Color)e.SelectedItem;
 			};
 			Add (rbBorderBrush);

+ 14 - 14
UICatalog/Scenarios/Buttons.cs

@@ -30,11 +30,11 @@ namespace UICatalog.Scenarios {
 				Y = Pos.Bottom (Win) - 3,
 				IsDefault = true,
 			};
-			defaultButton.Clicked += () => Application.RequestStop ();
+			defaultButton.Clicked += (s,e) => Application.RequestStop ();
 			Win.Add (defaultButton);
 
 			var swapButton = new Button (50, 0, "Swap Default (Absolute Layout)");
-			swapButton.Clicked += () => {
+			swapButton.Clicked += (s,e) => {
 				defaultButton.IsDefault = !defaultButton.IsDefault;
 				swapButton.IsDefault = !swapButton.IsDefault;
 			};
@@ -42,7 +42,7 @@ namespace UICatalog.Scenarios {
 
 			static void DoMessage (Button button, ustring txt)
 			{
-				button.Clicked += () => {
+				button.Clicked += (s,e) => {
 					var btnText = button.Text.ToString ();
 					MessageBox.Query ("Message", $"Did you click {txt}?", "Yes", "No");
 				};
@@ -83,14 +83,14 @@ namespace UICatalog.Scenarios {
 				X = 2,
 				Y = Pos.Bottom (button) + 1,
 			});
-			button.Clicked += () => MessageBox.Query ("Message", "Question?", "Yes", "No");
+			button.Clicked += (s,e) => MessageBox.Query ("Message", "Question?", "Yes", "No");
 
 			var textChanger = new Button ("Te_xt Changer") {
 				X = 2,
 				Y = Pos.Bottom (button) + 1,
 			};
 			Win.Add (textChanger);
-			textChanger.Clicked += () => textChanger.Text += "!";
+			textChanger.Clicked += (s,e) => textChanger.Text += "!";
 
 			Win.Add (button = new Button ("Lets see if this will move as \"Text Changer\" grows") {
 				X = Pos.Right (textChanger) + 2,
@@ -104,7 +104,7 @@ namespace UICatalog.Scenarios {
 			};
 			Win.Add (removeButton);
 			// This in interesting test case because `moveBtn` and below are laid out relative to this one!
-			removeButton.Clicked += () => {
+			removeButton.Clicked += (s,e) => {
 				// Now this throw a InvalidOperationException on the TopologicalSort method as is expected.
 				//Win.Remove (removeButton);
 
@@ -126,7 +126,7 @@ namespace UICatalog.Scenarios {
 				Width = 30,
 				ColorScheme = Colors.Error,
 			};
-			moveBtn.Clicked += () => {
+			moveBtn.Clicked += (s,e) => {
 				moveBtn.X = moveBtn.Frame.X + 5;
 				// This is already fixed with the call to SetNeedDisplay() in the Pos Dim.
 				//computedFrame.LayoutSubviews (); // BUGBUG: This call should not be needed. View.X is not causing relayout correctly
@@ -140,7 +140,7 @@ namespace UICatalog.Scenarios {
 				Width = 30,
 				ColorScheme = Colors.Error,
 			};
-			sizeBtn.Clicked += () => {
+			sizeBtn.Clicked += (s,e) => {
 				sizeBtn.Width = sizeBtn.Frame.Width + 5;
 				//computedFrame.LayoutSubviews (); // FIXED: This call should not be needed. View.X is not causing relayout correctly
 			};
@@ -158,7 +158,7 @@ namespace UICatalog.Scenarios {
 			var moveBtnA = new Button (0, 0, "Move This Button via Frame") {
 				ColorScheme = Colors.Error,
 			};
-			moveBtnA.Clicked += () => {
+			moveBtnA.Clicked += (s,e) => {
 				moveBtnA.Frame = new Rect (moveBtnA.Frame.X + 5, moveBtnA.Frame.Y, moveBtnA.Frame.Width, moveBtnA.Frame.Height);
 			};
 			absoluteFrame.Add (moveBtnA);
@@ -167,7 +167,7 @@ namespace UICatalog.Scenarios {
 			var sizeBtnA = new Button (0, 2, " ~  s  gui.cs   master ↑10 = Со_хранить") {
 				ColorScheme = Colors.Error,
 			};
-			sizeBtnA.Clicked += () => {
+			sizeBtnA.Clicked += (s,e) => {
 				sizeBtnA.Frame = new Rect (sizeBtnA.Frame.X, sizeBtnA.Frame.Y, sizeBtnA.Frame.Width + 5, sizeBtnA.Frame.Height);
 			};
 			absoluteFrame.Add (sizeBtnA);
@@ -218,7 +218,7 @@ namespace UICatalog.Scenarios {
 				Width = Dim.Width (computedFrame) - 2,
 				ColorScheme = Colors.TopLevel,
 			};
-			moveHotKeyBtn.Clicked += () => {
+			moveHotKeyBtn.Clicked += (s,e) => {
 				moveHotKeyBtn.Text = MoveHotkey (moveHotKeyBtn.Text);
 			};
 			Win.Add (moveHotKeyBtn);
@@ -230,12 +230,12 @@ namespace UICatalog.Scenarios {
 				Width = Dim.Width (absoluteFrame) - 2, // BUGBUG: Not always the width isn't calculated correctly.
 				ColorScheme = Colors.TopLevel,
 			};
-			moveUnicodeHotKeyBtn.Clicked += () => {
+			moveUnicodeHotKeyBtn.Clicked += (s,e) => {
 				moveUnicodeHotKeyBtn.Text = MoveHotkey (moveUnicodeHotKeyBtn.Text);
 			};
 			Win.Add (moveUnicodeHotKeyBtn);
 
-			radioGroup.SelectedItemChanged += (args) => {
+			radioGroup.SelectedItemChanged += (s, args) => {
 				switch (args.SelectedItem) {
 				case 0:
 					moveBtn.TextAlignment = TextAlignment.Left;
@@ -272,7 +272,7 @@ namespace UICatalog.Scenarios {
 				}
 			};
 
-			Application.Top.Ready += () => radioGroup.Refresh ();
+			Application.Top.Ready += (s,e) => radioGroup.Refresh ();
 		}
 	}
 }

+ 7 - 5
UICatalog/Scenarios/CharacterMap.cs

@@ -40,7 +40,7 @@ namespace UICatalog.Scenarios {
 			Win.Add (jumpEdit);
 			var errorLabel = new Label ("") { X = Pos.Right (jumpEdit) + 1, Y = Pos.Y (_charMap), ColorScheme = Colors.ColorSchemes ["error"] };
 			Win.Add (errorLabel);
-			jumpEdit.TextChanged += (s) => {
+			jumpEdit.TextChanged += (s, e) => {
 				uint result = 0;
 				if (jumpEdit.Text.Length == 0) return;
 				try {
@@ -84,7 +84,7 @@ namespace UICatalog.Scenarios {
 				Height = Dim.Fill(1),
 				SelectedItem = 0
 			};
-			jumpList.SelectedItemChanged += (args) => {
+			jumpList.SelectedItemChanged += (s, args) => {
 				_charMap.StartGlyph = radioItems [jumpList.SelectedItem].start;
 			};
 
@@ -157,7 +157,7 @@ namespace UICatalog.Scenarios {
 			ContentSize = new Size (CharMap.RowWidth, (int)(MaxCodePointVal / 16 + 1));
 			ShowVerticalScrollIndicator = true;
 			ShowHorizontalScrollIndicator = false;
-			LayoutComplete += (args) => {
+			LayoutComplete += (s, args) => {
 				if (Bounds.Width < RowWidth) {
 					ShowHorizontalScrollIndicator = true;
 				} else {
@@ -226,8 +226,10 @@ namespace UICatalog.Scenarios {
 			Clipboard.Contents = $"{new Rune (SelectedGlyph)}";
 		}
 
-		private void CharMap_DrawContent (Rect viewport)
+		private void CharMap_DrawContent (object sender, DrawEventArgs e)
 		{
+			Rect viewport = e.Rect;
+
 			var oldClip = Driver.Clip;
 			Driver.Clip = Bounds;
 			// Redraw doesn't know about the scroll indicators, so if off, add one to height
@@ -280,7 +282,7 @@ namespace UICatalog.Scenarios {
 		}
 
 		ContextMenu _contextMenu = new ContextMenu ();
-		void Handle_MouseClick (MouseEventArgs args)
+		void Handle_MouseClick (object sender, MouseEventEventArgs args)
 		{
 			var me = args.MouseEvent;
 			if (me.Flags == MouseFlags.ReportMousePosition || (me.Flags != MouseFlags.Button1Clicked &&

+ 7 - 4
UICatalog/Scenarios/Clipping.cs

@@ -37,7 +37,8 @@ namespace UICatalog.Scenarios {
 				Y = 3,
 				Width = Dim.Fill (3),
 				Height = Dim.Fill (3),
-				ColorScheme = Colors.Dialog
+				ColorScheme = Colors.Dialog,
+				Id = "1"
 			};
 
 			var embedded2 = new Window ("2") {
@@ -45,7 +46,8 @@ namespace UICatalog.Scenarios {
 				Y = 3,
 				Width = Dim.Fill (3),
 				Height = Dim.Fill (3),
-				ColorScheme = Colors.Error
+				ColorScheme = Colors.Error,
+				Id = "2"
 			};
 			embedded1.Add (embedded2);
 
@@ -54,11 +56,12 @@ namespace UICatalog.Scenarios {
 				Y = 3,
 				Width = Dim.Fill (3),
 				Height = Dim.Fill (3),
-				ColorScheme = Colors.TopLevel
+				ColorScheme = Colors.TopLevel,
+				Id = "3"
 			};
 
 			var testButton = new Button (2, 2, "click me");
-			testButton.Clicked += () => {
+			testButton.Clicked += (s,e) => {
 				MessageBox.Query (10, 5, "Test", "test message", "Ok");
 			};
 			embedded3.Add (testButton);

+ 4 - 4
UICatalog/Scenarios/CollectionNavigatorTester.cs

@@ -142,8 +142,8 @@ namespace UICatalog.Scenarios {
 
 			_listView.SetSource (_items);
 
-			_listView.KeystrokeNavigator.SearchStringChanged += (state) => {
-				label.Text = $"ListView: {state.SearchString}";
+			_listView.KeystrokeNavigator.SearchStringChanged += (s,e) => {
+				label.Text = $"ListView: {e.SearchString}";
 			};
 		}
 
@@ -179,8 +179,8 @@ namespace UICatalog.Scenarios {
 			_treeView.ExpandAll ();
 			_treeView.GoToFirst ();
 
-			_treeView.KeystrokeNavigator.SearchStringChanged += (state) => {
-				label.Text = $"TreeView: {state.SearchString}";
+			_treeView.KeystrokeNavigator.SearchStringChanged += (s,e) => {
+				label.Text = $"TreeView: {e.SearchString}";
 			};
 		}
 

+ 2 - 2
UICatalog/Scenarios/ColorPicker.cs

@@ -78,7 +78,7 @@ namespace UICatalog.Scenarios {
 		/// <summary>
 		/// Fired when foreground color is changed.
 		/// </summary>
-		private void ForegroundColor_ColorChanged ()
+		private void ForegroundColor_ColorChanged (object sender, EventArgs e)
 		{
 			UpdateColorLabel (foregroundColorLabel, foregroundColorPicker);
 			UpdateDemoLabel ();
@@ -87,7 +87,7 @@ namespace UICatalog.Scenarios {
 		/// <summary>
 		/// Fired when background color is changed.
 		/// </summary>
-		private void BackgroundColor_ColorChanged ()
+		private void BackgroundColor_ColorChanged (object sender, EventArgs e)
 		{
 			UpdateColorLabel (backgroundColorLabel, backgroundColorPicker);
 			UpdateDemoLabel ();

+ 4 - 4
UICatalog/Scenarios/ComboBoxIteration.cs

@@ -38,12 +38,12 @@ namespace UICatalog.Scenarios {
 			};
 			comboBox.SetSource (items);
 
-			listview.SelectedItemChanged += (e) => {
+			listview.SelectedItemChanged += (s,e) => {
 				lbListView.Text = items [e.Item];
 				comboBox.SelectedItem = e.Item;
 			};
 
-			comboBox.SelectedItemChanged += (ListViewItemEventArgs text) => {
+			comboBox.SelectedItemChanged += (object sender, ListViewItemEventArgs text) => {
 				if (text.Item != -1) {
 					lbComboBox.Text = text.Value.ToString ();
 					listview.SelectedItem = text.Item;
@@ -55,7 +55,7 @@ namespace UICatalog.Scenarios {
 			var btnTwo = new Button ("Two") {
 				X = Pos.Right (comboBox) + 1,
 			};
-			btnTwo.Clicked += () => {
+			btnTwo.Clicked += (s,e) => {
 				items = new List<string> () { "one", "two" };
 				comboBox.SetSource (items);
 				listview.SetSource (items);
@@ -67,7 +67,7 @@ namespace UICatalog.Scenarios {
 				X = Pos.Right (comboBox) + 1,
 				Y = Pos.Top (comboBox)
 			};
-			btnThree.Clicked += () => {
+			btnThree.Clicked += (s,e) => {
 				items = new List<string> () { "one", "two", "three" };
 				comboBox.SetSource (items);
 				listview.SetSource (items);

+ 5 - 5
UICatalog/Scenarios/ComputedLayout.cs

@@ -53,7 +53,7 @@ namespace UICatalog.Scenarios {
 				ColorScheme = Colors.Error
 			};
 
-			Application.Top.LayoutComplete += (a) => {
+			Application.Top.LayoutComplete += (s, a) => {
 				horizontalRuler.Text = rule.Repeat ((int)Math.Ceiling ((double)(horizontalRuler.Bounds.Width) / (double)rule.Length)) [0..(horizontalRuler.Bounds.Width)];
 				verticalRuler.Text = vrule.Repeat ((int)Math.Ceiling ((double)(verticalRuler.Bounds.Height * 2) / (double)rule.Length)) [0..(verticalRuler.Bounds.Height*2)];
 			};
@@ -210,7 +210,7 @@ namespace UICatalog.Scenarios {
 				Y = Pos.AnchorEnd () - 1,
 			};
 			anchorButton.X = Pos.AnchorEnd () - (Pos.Right (anchorButton) - Pos.Left (anchorButton));
-			anchorButton.Clicked += () => {
+			anchorButton.Clicked += (s,e) => {
 				// Ths demonstrates how to have a dynamically sized button
 				// Each time the button is clicked the button's text gets longer
 				// The call to Application.Top.LayoutSubviews causes the Computed layout to
@@ -246,7 +246,7 @@ namespace UICatalog.Scenarios {
 			var leftButton = new Button ("Left") {
 				Y = Pos.AnchorEnd () - 1 // Pos.Combine
 			};
-			leftButton.Clicked += () => {
+			leftButton.Clicked += (s,e) => {
 				// Ths demonstrates how to have a dynamically sized button
 				// Each time the button is clicked the button's text gets longer
 				// The call to Application.Top.LayoutSubviews causes the Computed layout to
@@ -261,7 +261,7 @@ namespace UICatalog.Scenarios {
 				X = Pos.Center (),
 				Y = Pos.AnchorEnd (1)  // Pos.AnchorEnd(1)
 			};
-			centerButton.Clicked += () => {
+			centerButton.Clicked += (s,e) => {
 				// Ths demonstrates how to have a dynamically sized button
 				// Each time the button is clicked the button's text gets longer
 				// The call to Application.Top.LayoutSubviews causes the Computed layout to
@@ -274,7 +274,7 @@ namespace UICatalog.Scenarios {
 			var rightButton = new Button ("Right") {
 				Y = Pos.Y (centerButton)
 			};
-			rightButton.Clicked += () => {
+			rightButton.Clicked += (s,e) => {
 				// Ths demonstrates how to have a dynamically sized button
 				// Each time the button is clicked the button's text gets longer
 				// The call to Application.Top.LayoutSubviews causes the Computed layout to

+ 2 - 2
UICatalog/Scenarios/ConfigurationEditor.cs

@@ -84,7 +84,7 @@ namespace UICatalog.Scenarios {
 
 			internal ConfigTextView ()
 			{
-				ContentsChanged += (obj) => {
+				ContentsChanged += (s,obj) => {
 					if (IsDirty) {
 						if (!Tile.Title.EndsWith ('*')) {
 							Tile.Title += '*';
@@ -167,7 +167,7 @@ namespace UICatalog.Scenarios {
 
 				textView.Read ();
 
-				textView.Enter += (a) => {
+				textView.Enter += (s,e) => {
 					_lenStatusItem.Title = $"Len:{textView.Text.Length}";
 				};
 

+ 3 - 3
UICatalog/Scenarios/ContextMenus.cs

@@ -58,14 +58,14 @@ namespace UICatalog.Scenarios {
 
 			Point mousePos = default;
 
-			Win.KeyPress += (e) => {
+			Win.KeyPress += (s, e) => {
 				if (e.KeyEvent.Key == (Key.Space | Key.CtrlMask)) {
 					ShowContextMenu (mousePos.X, mousePos.Y);
 					e.Handled = true;
 				}
 			};
 
-			Win.MouseClick += (e) => {
+			Win.MouseClick += (s, e) => {
 				if (e.MouseEvent.Flags == contextMenu.MouseFlags) {
 					ShowContextMenu (e.MouseEvent.X, e.MouseEvent.Y);
 					e.Handled = true;
@@ -81,7 +81,7 @@ namespace UICatalog.Scenarios {
 
 			Win.WantMousePositionReports = true;
 
-			Application.Top.Closed += (_) => {
+			Application.Top.Closed += (s,e) => {
 				Thread.CurrentThread.CurrentUICulture = new CultureInfo ("en-US");
 				Application.RootMouseEvent -= Application_RootMouseEvent;
 			};

+ 9 - 9
UICatalog/Scenarios/CsvEditor.cs

@@ -99,7 +99,7 @@ namespace UICatalog.Scenarios {
 			SetupScrollBar ();
 		}
 
-		private void SelectedCellLabel_TextChanged (ustring last)
+		private void SelectedCellLabel_TextChanged (object sender, TextChangedEventArgs e)
 		{
 			// if user is in the text control and editing the selected cell
 			if (!selectedCellLabel.HasFocus)
@@ -114,7 +114,7 @@ namespace UICatalog.Scenarios {
 			}
 		}
 
-		private void OnSelectedCellChanged (TableView.SelectedCellChangedEventArgs e)
+		private void OnSelectedCellChanged (object sender, SelectedCellChangedEventArgs e)
 		{
 			// only update the text box if the user is not manually editing it
 			if (!selectedCellLabel.HasFocus)
@@ -446,7 +446,7 @@ namespace UICatalog.Scenarios {
 		{
 			var _scrollBar = new ScrollBarView (tableView, true);
 
-			_scrollBar.ChangedPosition += () => {
+			_scrollBar.ChangedPosition += (s,e) => {
 				tableView.RowOffset = _scrollBar.Position;
 				if (tableView.RowOffset != _scrollBar.Position) {
 					_scrollBar.Position = tableView.RowOffset;
@@ -454,7 +454,7 @@ namespace UICatalog.Scenarios {
 				tableView.SetNeedsDisplay ();
 			};
 			/*
-			_scrollBar.OtherScrollBarView.ChangedPosition += () => {
+			_scrollBar.OtherScrollBarView.ChangedPosition += (s,e) => {
 				_listView.LeftItem = _scrollBar.OtherScrollBarView.Position;
 				if (_listView.LeftItem != _scrollBar.OtherScrollBarView.Position) {
 					_scrollBar.OtherScrollBarView.Position = _listView.LeftItem;
@@ -462,7 +462,7 @@ namespace UICatalog.Scenarios {
 				_listView.SetNeedsDisplay ();
 			};*/
 
-			tableView.DrawContent += (e) => {
+			tableView.DrawContent += (s,e) => {
 				_scrollBar.Size = tableView.Table?.Rows?.Count ?? 0;
 				_scrollBar.Position = tableView.RowOffset;
 				//	_scrollBar.OtherScrollBarView.Size = _listView.Maxlength - 1;
@@ -472,7 +472,7 @@ namespace UICatalog.Scenarios {
 
 		}
 
-		private void TableViewKeyPress (View.KeyEventEventArgs e)
+		private void TableViewKeyPress (object sender, KeyEventEventArgs e)
 		{
 			if (e.KeyEvent.Key == Key.DeleteChar) {
 
@@ -514,9 +514,9 @@ namespace UICatalog.Scenarios {
 			bool okPressed = false;
 
 			var ok = new Button ("Ok", is_default: true);
-			ok.Clicked += () => { okPressed = true; Application.RequestStop (); };
+			ok.Clicked += (s,e) => { okPressed = true; Application.RequestStop (); };
 			var cancel = new Button ("Cancel");
-			cancel.Clicked += () => { Application.RequestStop (); };
+			cancel.Clicked += (s,e) => { Application.RequestStop (); };
 			var d = new Dialog (title, 60, 20, ok, cancel);
 
 			var lbl = new Label () {
@@ -540,7 +540,7 @@ namespace UICatalog.Scenarios {
 			enteredText = okPressed ? tf.Text.ToString () : null;
 			return okPressed;
 		}
-		private void EditCurrentCell (TableView.CellActivatedEventArgs e)
+		private void EditCurrentCell (object sender, CellActivatedEventArgs e)
 		{
 			if (e.Table == null)
 				return;

+ 7 - 7
UICatalog/Scenarios/Dialogs.cs

@@ -123,7 +123,7 @@ namespace UICatalog.Scenarios {
 			};
 			frame.Add (styleRadioGroup);
 
-			void Top_Loaded ()
+			void Top_Loaded (object sender, EventArgs args)
 			{
 				// BUGBUG: This breaks with v2 ; causes TopologicalSort issue. Not sure why
 				//frame.Height = Dim.Height (widthEdit) + Dim.Height (heightEdit) + Dim.Height (titleEdit)
@@ -157,7 +157,7 @@ namespace UICatalog.Scenarios {
 				Y = Pos.Bottom (frame) + 2,
 				IsDefault = true,
 			};
-			showDialogButton.Clicked += () => {
+			showDialogButton.Clicked += (s,e) => {
 				try {
 					Dialog dialog = null;
 
@@ -181,7 +181,7 @@ namespace UICatalog.Scenarios {
 							button = new Button (NumberToWords.Convert (buttonId),
 							       is_default: buttonId == 0);
 						}
-						button.Clicked += () => {
+						button.Clicked += (s,e) => {
 							clicked = buttonId;
 							Application.RequestStop ();
 						};
@@ -206,7 +206,7 @@ namespace UICatalog.Scenarios {
 						X = Pos.Center (),
 						Y = Pos.Center ()
 					};
-					add.Clicked += () => {
+					add.Clicked += (s,e) => {
 						var buttonId = buttons.Count;
 						Button button;
 						if (glyphsNotWords.Checked == true) {
@@ -216,7 +216,7 @@ namespace UICatalog.Scenarios {
 							button = new Button (NumberToWords.Convert (buttonId),
 								is_default: buttonId == 0);
 						}
-						button.Clicked += () => {
+						button.Clicked += (s,e) => {
 							clicked = buttonId;
 							Application.RequestStop ();
 
@@ -233,13 +233,13 @@ namespace UICatalog.Scenarios {
 						X = Pos.Center (),
 						Y = Pos.Center () + 1
 					};
-					addChar.Clicked += () => {
+					addChar.Clicked += (s,e) => {
 						foreach (var button in buttons) {
 							button.Text += Char.ConvertFromUtf32 (CODE_POINT);
 						}
 						dialog.LayoutSubviews ();
 					};
-					dialog.Closed += (args) => {
+					dialog.Closed += (s,e) => {
 						buttonPressedLabel.Text = $"{clicked}";
 					};
 					dialog.Add (addChar);

+ 26 - 26
UICatalog/Scenarios/DynamicMenuBar.cs

@@ -89,7 +89,7 @@ namespace UICatalog.Scenarios {
 					X = Pos.Center (),
 					Width = 2,
 				};
-				_txtDelimiter.TextChanged += (_) => MenuBar.ShortcutDelimiter = _txtDelimiter.Text;
+				_txtDelimiter.TextChanged += (s, _) => MenuBar.ShortcutDelimiter = _txtDelimiter.Text;
 				_frmDelimiter.Add (_txtDelimiter);
 
 				Add (_frmDelimiter);
@@ -209,7 +209,7 @@ namespace UICatalog.Scenarios {
 				};
 				Add (_frmMenuDetails);
 
-				_btnMenuBarUp.Clicked += () => {
+				_btnMenuBarUp.Clicked += (s,e) => {
 					var i = _currentSelectedMenuBar;
 					var menuItem = _menuBar != null && _menuBar.Menus.Length > 0 ? _menuBar.Menus [i] : null;
 					if (menuItem != null) {
@@ -223,7 +223,7 @@ namespace UICatalog.Scenarios {
 					}
 				};
 
-				_btnMenuBarDown.Clicked += () => {
+				_btnMenuBarDown.Clicked += (s,e) => {
 					var i = _currentSelectedMenuBar;
 					var menuItem = _menuBar != null && _menuBar.Menus.Length > 0 ? _menuBar.Menus [i] : null;
 					if (menuItem != null) {
@@ -237,7 +237,7 @@ namespace UICatalog.Scenarios {
 					}
 				};
 
-				_btnUp.Clicked += () => {
+				_btnUp.Clicked += (s,e) => {
 					var i = _lstMenus.SelectedItem;
 					var menuItem = DataContext.Menus.Count > 0 ? DataContext.Menus [i].MenuItem : null;
 					if (menuItem != null) {
@@ -252,7 +252,7 @@ namespace UICatalog.Scenarios {
 					}
 				};
 
-				_btnDown.Clicked += () => {
+				_btnDown.Clicked += (s,e) => {
 					var i = _lstMenus.SelectedItem;
 					var menuItem = DataContext.Menus.Count > 0 ? DataContext.Menus [i].MenuItem : null;
 					if (menuItem != null) {
@@ -267,7 +267,7 @@ namespace UICatalog.Scenarios {
 					}
 				};
 
-				_btnPreviowsParent.Clicked += () => {
+				_btnPreviowsParent.Clicked += (s,e) => {
 					if (_currentMenuBarItem != null && _currentMenuBarItem.Parent != null) {
 						var mi = _currentMenuBarItem;
 						_currentMenuBarItem = _currentMenuBarItem.Parent as MenuBarItem;
@@ -297,16 +297,16 @@ namespace UICatalog.Scenarios {
 					X = Pos.Right (_btnOk) + 3,
 					Y = Pos.Top (_btnOk),
 				};
-				_btnCancel.Clicked += () => {
+				_btnCancel.Clicked += (s,e) => {
 					SetFrameDetails (_currentEditMenuBarItem);
 				};
 				Add (_btnCancel);
 
-				_lstMenus.SelectedItemChanged += (e) => {
+				_lstMenus.SelectedItemChanged += (s,e) => {
 					SetFrameDetails ();
 				};
 
-				_btnOk.Clicked += () => {
+				_btnOk.Clicked += (s,e) => {
 					if (ustring.IsNullOrEmpty (_frmMenuDetails._txtTitle.Text) && _currentEditMenuBarItem != null) {
 						MessageBox.ErrorQuery ("Invalid title", "Must enter a valid title!.", "Ok");
 					} else if (_currentEditMenuBarItem != null) {
@@ -322,7 +322,7 @@ namespace UICatalog.Scenarios {
 					}
 				};
 
-				_btnAdd.Clicked += () => {
+				_btnAdd.Clicked += (s,e) => {
 					if (MenuBar == null) {
 						MessageBox.ErrorQuery ("Menu Bar Error", "Must add a MenuBar first!", "Ok");
 						_btnAddMenuBar.SetFocus ();
@@ -359,7 +359,7 @@ namespace UICatalog.Scenarios {
 					}
 				};
 
-				_btnRemove.Clicked += () => {
+				_btnRemove.Clicked += (s,e) => {
 					var menuItem = DataContext.Menus.Count > 0 ? DataContext.Menus [_lstMenus.SelectedItem].MenuItem : null;
 					if (menuItem != null) {
 						var childrens = ((MenuBarItem)_currentMenuBarItem).Children;
@@ -391,7 +391,7 @@ namespace UICatalog.Scenarios {
 					}
 				};
 
-				_lstMenus.OpenSelectedItem += (e) => {
+				_lstMenus.OpenSelectedItem += (s,e) => {
 					_currentMenuBarItem = DataContext.Menus [e.Item].MenuItem;
 					if (!(_currentMenuBarItem is MenuBarItem)) {
 						MessageBox.ErrorQuery ("Menu Open Error", "Must allows sub menus first!", "Ok");
@@ -404,33 +404,33 @@ namespace UICatalog.Scenarios {
 					SetFrameDetails (menuBarItem);
 				};
 
-				_lstMenus.Enter += (_) => {
+				_lstMenus.Enter += (s, e) => {
 					var menuBarItem = DataContext.Menus.Count > 0 ? DataContext.Menus [_lstMenus.SelectedItem].MenuItem : null;
 					SetFrameDetails (menuBarItem);
 				};
 
-				_btnNext.Clicked += () => {
+				_btnNext.Clicked += (s,e) => {
 					if (_menuBar != null && _currentSelectedMenuBar + 1 < _menuBar.Menus.Length) {
 						_currentSelectedMenuBar++;
 					}
 					SelectCurrentMenuBarItem ();
 				};
 
-				_btnPrevious.Clicked += () => {
+				_btnPrevious.Clicked += (s,e) => {
 					if (_currentSelectedMenuBar - 1 > -1) {
 						_currentSelectedMenuBar--;
 					}
 					SelectCurrentMenuBarItem ();
 				};
 
-				_lblMenuBar.Enter += (e) => {
+				_lblMenuBar.Enter += (s, e) => {
 					if (_menuBar?.Menus != null) {
 						_currentMenuBarItem = _menuBar.Menus [_currentSelectedMenuBar];
 						SetFrameDetails (_menuBar.Menus [_currentSelectedMenuBar]);
 					}
 				};
 
-				_btnAddMenuBar.Clicked += () => {
+				_btnAddMenuBar.Clicked += (s,e) => {
 					var frameDetails = new DynamicMenuBarDetails (null, false);
 					var item = frameDetails.EnterMenuItem ();
 					if (item == null) {
@@ -457,7 +457,7 @@ namespace UICatalog.Scenarios {
 					_menuBar.SetNeedsDisplay ();
 				};
 
-				_btnRemoveMenuBar.Clicked += () => {
+				_btnRemoveMenuBar.Clicked += (s,e) => {
 					if (_menuBar == null || _menuBar.Menus.Length == 0) {
 						return;
 					}
@@ -729,7 +729,7 @@ namespace UICatalog.Scenarios {
 					Width = Dim.Fill (),
 					ReadOnly = true
 				};
-				_txtShortcut.KeyDown += (e) => {
+				_txtShortcut.KeyDown += (s, e) => {
 					if (!ProcessKey (e.KeyEvent)) {
 						return;
 					}
@@ -772,7 +772,7 @@ namespace UICatalog.Scenarios {
 					return true;
 				}
 
-				_txtShortcut.KeyUp += (e) => {
+				_txtShortcut.KeyUp += (s, e) => {
 					var k = ShortcutHelper.GetModifiersKey (e.KeyEvent);
 					if (CheckShortcut (k, false)) {
 						e.Handled = true;
@@ -784,12 +784,12 @@ namespace UICatalog.Scenarios {
 					X = Pos.X (_lblShortcut),
 					Y = Pos.Bottom (_txtShortcut) + 1
 				};
-				_btnShortcut.Clicked += () => {
+				_btnShortcut.Clicked += (s,e) => {
 					_txtShortcut.Text = "";
 				};
 				Add (_btnShortcut);
 
-				_ckbIsTopLevel.Toggled += (e) => {
+				_ckbIsTopLevel.Toggled += (s, e) => {
 					if ((_menuItem != null && _menuItem.Parent != null && (bool)_ckbIsTopLevel.Checked) ||
 						_menuItem == null && hasParent && (bool)_ckbIsTopLevel.Checked) {
 						MessageBox.ErrorQuery ("Invalid IsTopLevel", "Only menu bar can have top level menu item!", "Ok");
@@ -814,7 +814,7 @@ namespace UICatalog.Scenarios {
 						_txtAction.Enabled = false;
 					}
 				};
-				_ckbSubMenu.Toggled += (e) => {
+				_ckbSubMenu.Toggled += (s, e) => {
 					if ((bool)_ckbSubMenu.Checked) {
 						_ckbIsTopLevel.Checked = false;
 						_ckbIsTopLevel.SetNeedsDisplay ();
@@ -835,7 +835,7 @@ namespace UICatalog.Scenarios {
 						_txtShortcut.Enabled = _ckbIsTopLevel.Checked == false && _ckbSubMenu.Checked == false;
 					}
 				};
-				_ckbNullCheck.Toggled += (e) => {
+				_ckbNullCheck.Toggled += (s,e) => {
 					if (_menuItem != null) {
 						_menuItem.AllowNullChecked = (bool)_ckbNullCheck.Checked;
 					}
@@ -868,7 +868,7 @@ namespace UICatalog.Scenarios {
 				var _btnOk = new Button ("Ok") {
 					IsDefault = true,
 				};
-				_btnOk.Clicked += () => {
+				_btnOk.Clicked += (s,e) => {
 					if (ustring.IsNullOrEmpty (_txtTitle.Text)) {
 						MessageBox.ErrorQuery ("Invalid title", "Must enter a valid title!.", "Ok");
 					} else {
@@ -877,7 +877,7 @@ namespace UICatalog.Scenarios {
 					}
 				};
 				var _btnCancel = new Button ("Cancel");
-				_btnCancel.Clicked += () => {
+				_btnCancel.Clicked += (s,e) => {
 					_txtTitle.Text = ustring.Empty;
 					Application.RequestStop ();
 				};

+ 16 - 16
UICatalog/Scenarios/DynamicStatusBar.cs

@@ -77,7 +77,7 @@ namespace UICatalog.Scenarios {
 					X = Pos.Center (),
 					Width = 2,
 				};
-				_txtDelimiter.TextChanged += (_) => StatusBar.ShortcutDelimiter = _txtDelimiter.Text;
+				_txtDelimiter.TextChanged += (s, _) => StatusBar.ShortcutDelimiter = _txtDelimiter.Text;
 				_frmDelimiter.Add (_txtDelimiter);
 
 				Add (_frmDelimiter);
@@ -142,7 +142,7 @@ namespace UICatalog.Scenarios {
 				};
 				Add (_frmStatusBarDetails);
 
-				_btnUp.Clicked += () => {
+				_btnUp.Clicked += (s,e) => {
 					var i = _lstItems.SelectedItem;
 					var statusItem = DataContext.Items.Count > 0 ? DataContext.Items [i].StatusItem : null;
 					if (statusItem != null) {
@@ -158,7 +158,7 @@ namespace UICatalog.Scenarios {
 					}
 				};
 
-				_btnDown.Clicked += () => {
+				_btnDown.Clicked += (s,e) => {
 					var i = _lstItems.SelectedItem;
 					var statusItem = DataContext.Items.Count > 0 ? DataContext.Items [i].StatusItem : null;
 					if (statusItem != null) {
@@ -184,16 +184,16 @@ namespace UICatalog.Scenarios {
 					X = Pos.Right (_btnOk) + 3,
 					Y = Pos.Top (_btnOk),
 				};
-				_btnCancel.Clicked += () => {
+				_btnCancel.Clicked += (s,e) => {
 					SetFrameDetails (_currentEditStatusItem);
 				};
 				Add (_btnCancel);
 
-				_lstItems.SelectedItemChanged += (e) => {
+				_lstItems.SelectedItemChanged += (s, e) => {
 					SetFrameDetails ();
 				};
 
-				_btnOk.Clicked += () => {
+				_btnOk.Clicked += (s,e) => {
 					if (ustring.IsNullOrEmpty (_frmStatusBarDetails._txtTitle.Text) && _currentEditStatusItem != null) {
 						MessageBox.ErrorQuery ("Invalid title", "Must enter a valid title!.", "Ok");
 					} else if (_currentEditStatusItem != null) {
@@ -206,7 +206,7 @@ namespace UICatalog.Scenarios {
 					}
 				};
 
-				_btnAdd.Clicked += () => {
+				_btnAdd.Clicked += (s,e) => {
 					if (StatusBar == null) {
 						MessageBox.ErrorQuery ("StatusBar Bar Error", "Must add a StatusBar first!", "Ok");
 						_btnAddStatusBar.SetFocus ();
@@ -227,7 +227,7 @@ namespace UICatalog.Scenarios {
 					SetFrameDetails ();
 				};
 
-				_btnRemove.Clicked += () => {
+				_btnRemove.Clicked += (s,e) => {
 					var statusItem = DataContext.Items.Count > 0 ? DataContext.Items [_lstItems.SelectedItem].StatusItem : null;
 					if (statusItem != null) {
 						_statusBar.RemoveItem (_currentSelectedStatusBar);
@@ -240,12 +240,12 @@ namespace UICatalog.Scenarios {
 					}
 				};
 
-				_lstItems.Enter += (_) => {
+				_lstItems.Enter += (s, e) => {
 					var statusItem = DataContext.Items.Count > 0 ? DataContext.Items [_lstItems.SelectedItem].StatusItem : null;
 					SetFrameDetails (statusItem);
 				};
 
-				_btnAddStatusBar.Clicked += () => {
+				_btnAddStatusBar.Clicked += (s,e) => {
 					if (_statusBar != null) {
 						return;
 					}
@@ -254,7 +254,7 @@ namespace UICatalog.Scenarios {
 					Add (_statusBar);
 				};
 
-				_btnRemoveStatusBar.Clicked += () => {
+				_btnRemoveStatusBar.Clicked += (s,e) => {
 					if (_statusBar == null) {
 						return;
 					}
@@ -401,7 +401,7 @@ namespace UICatalog.Scenarios {
 					Width = Dim.Fill (),
 					ReadOnly = true
 				};
-				_txtShortcut.KeyDown += (e) => {
+				_txtShortcut.KeyDown += (s, e) => {
 					if (!ProcessKey (e.KeyEvent)) {
 						return;
 					}
@@ -445,7 +445,7 @@ namespace UICatalog.Scenarios {
 					return true;
 				}
 
-				_txtShortcut.KeyUp += (e) => {
+				_txtShortcut.KeyUp += (s, e) => {
 					var k = ShortcutHelper.GetModifiersKey (e.KeyEvent);
 					if (CheckShortcut (k, false)) {
 						e.Handled = true;
@@ -457,7 +457,7 @@ namespace UICatalog.Scenarios {
 					X = Pos.X (_lblShortcut),
 					Y = Pos.Bottom (_txtShortcut) + 1
 				};
-				_btnShortcut.Clicked += () => {
+				_btnShortcut.Clicked += (s,e) => {
 					_txtShortcut.Text = "";
 				};
 				Add (_btnShortcut);
@@ -479,7 +479,7 @@ namespace UICatalog.Scenarios {
 				var _btnOk = new Button ("Ok") {
 					IsDefault = true,
 				};
-				_btnOk.Clicked += () => {
+				_btnOk.Clicked += (s,e) => {
 					if (ustring.IsNullOrEmpty (_txtTitle.Text)) {
 						MessageBox.ErrorQuery ("Invalid title", "Must enter a valid title!.", "Ok");
 					} else {
@@ -492,7 +492,7 @@ namespace UICatalog.Scenarios {
 					}
 				};
 				var _btnCancel = new Button ("Cancel");
-				_btnCancel.Clicked += () => {
+				_btnCancel.Clicked += (s,e) => {
 					_txtTitle.Text = ustring.Empty;
 					Application.RequestStop ();
 				};

+ 27 - 27
UICatalog/Scenarios/Editor.cs

@@ -62,8 +62,8 @@ namespace UICatalog.Scenarios {
 
 			var siCursorPosition = new StatusItem (Key.Null, "", null);
 
-			_textView.UnwrappedCursorPosition += (e) => {
-				siCursorPosition.Title = $"Ln {e.Y + 1}, Col {e.X + 1}";
+			_textView.UnwrappedCursorPosition += (s,e) => {
+				siCursorPosition.Title = $"Ln {e.Point.Y + 1}, Col {e.Point.X + 1}";
 			};
 
 			LoadFile ();
@@ -131,7 +131,7 @@ namespace UICatalog.Scenarios {
 
 			_scrollBar = new ScrollBarView (_textView, true);
 
-			_scrollBar.ChangedPosition += () => {
+			_scrollBar.ChangedPosition += (s,e) => {
 				_textView.TopRow = _scrollBar.Position;
 				if (_textView.TopRow != _scrollBar.Position) {
 					_scrollBar.Position = _textView.TopRow;
@@ -139,7 +139,7 @@ namespace UICatalog.Scenarios {
 				_textView.SetNeedsDisplay ();
 			};
 
-			_scrollBar.OtherScrollBarView.ChangedPosition += () => {
+			_scrollBar.OtherScrollBarView.ChangedPosition += (s,e) => {
 				_textView.LeftColumn = _scrollBar.OtherScrollBarView.Position;
 				if (_textView.LeftColumn != _scrollBar.OtherScrollBarView.Position) {
 					_scrollBar.OtherScrollBarView.Position = _textView.LeftColumn;
@@ -147,7 +147,7 @@ namespace UICatalog.Scenarios {
 				_textView.SetNeedsDisplay ();
 			};
 
-			_scrollBar.VisibleChanged += () => {
+			_scrollBar.VisibleChanged += (s,e) => {
 				if (_scrollBar.Visible && _textView.RightOffset == 0) {
 					_textView.RightOffset = 1;
 				} else if (!_scrollBar.Visible && _textView.RightOffset == 1) {
@@ -155,7 +155,7 @@ namespace UICatalog.Scenarios {
 				}
 			};
 
-			_scrollBar.OtherScrollBarView.VisibleChanged += () => {
+			_scrollBar.OtherScrollBarView.VisibleChanged += (s,e) => {
 				if (_scrollBar.OtherScrollBarView.Visible && _textView.BottomOffset == 0) {
 					_textView.BottomOffset = 1;
 				} else if (!_scrollBar.OtherScrollBarView.Visible && _textView.BottomOffset == 1) {
@@ -163,7 +163,7 @@ namespace UICatalog.Scenarios {
 				}
 			};
 
-			_textView.DrawContent += (e) => {
+			_textView.DrawContent += (s,e) => {
 				_scrollBar.Size = _textView.Lines;
 				_scrollBar.Position = _textView.TopRow;
 				if (_scrollBar.OtherScrollBarView != null) {
@@ -174,7 +174,7 @@ namespace UICatalog.Scenarios {
 				_scrollBar.Refresh ();
 			};
 
-			Win.KeyPress += (e) => {
+			Win.KeyPress += (s, e) => {
 				var keys = ShortcutHelper.GetModifiersKey (e.KeyEvent);
 				if (_winDialog != null && (e.KeyEvent.Key == Key.Esc
 					|| e.KeyEvent.Key == Application.QuitKey)) {
@@ -199,7 +199,7 @@ namespace UICatalog.Scenarios {
 				}
 			};
 
-			Application.Top.Closed += (_) => Thread.CurrentThread.CurrentUICulture = new CultureInfo ("en-US");
+			Application.Top.Closed += (s,e) => Thread.CurrentThread.CurrentUICulture = new CultureInfo ("en-US");
 		}
 
 		private void DisposeWinDialog ()
@@ -768,7 +768,7 @@ namespace UICatalog.Scenarios {
 		private View FindTab ()
 		{
 			var d = new View ();
-			d.DrawContent += (e) => {
+			d.DrawContent += (s,e) => {
 				foreach (var v in d.Subviews) {
 					v.SetNeedsDisplay ();
 				}
@@ -790,7 +790,7 @@ namespace UICatalog.Scenarios {
 				Y = Pos.Top (label),
 				Width = 20
 			};
-			txtToFind.Enter += (_) => txtToFind.Text = _textToFind;
+			txtToFind.Enter += (s, e) => txtToFind.Text = _textToFind;
 			d.Add (txtToFind);
 
 			var btnFindNext = new Button ("Find _Next") {
@@ -802,7 +802,7 @@ namespace UICatalog.Scenarios {
 				IsDefault = true,
 				AutoSize = false
 			};
-			btnFindNext.Clicked += () => FindNext ();
+			btnFindNext.Clicked += (s,e) => FindNext ();
 			d.Add (btnFindNext);
 
 			var btnFindPrevious = new Button ("Find _Previous") {
@@ -813,10 +813,10 @@ namespace UICatalog.Scenarios {
 				TextAlignment = TextAlignment.Centered,
 				AutoSize = false
 			};
-			btnFindPrevious.Clicked += () => FindPrevious ();
+			btnFindPrevious.Clicked += (s,e) => FindPrevious ();
 			d.Add (btnFindPrevious);
 
-			txtToFind.TextChanged += (e) => {
+			txtToFind.TextChanged += (s, e) => {
 				_textToFind = txtToFind.Text.ToString ();
 				_textView.FindTextChanged ();
 				btnFindNext.Enabled = !txtToFind.Text.IsEmpty;
@@ -830,7 +830,7 @@ namespace UICatalog.Scenarios {
 				TextAlignment = TextAlignment.Centered,
 				AutoSize = false
 			};
-			btnCancel.Clicked += () => {
+			btnCancel.Clicked += (s,e) => {
 				DisposeWinDialog ();
 			};
 			d.Add (btnCancel);
@@ -840,7 +840,7 @@ namespace UICatalog.Scenarios {
 				Y = Pos.Top (txtToFind) + 2,
 				Checked = _matchCase
 			};
-			ckbMatchCase.Toggled += (e) => _matchCase = (bool)ckbMatchCase.Checked;
+			ckbMatchCase.Toggled += (s, e) => _matchCase = (bool)ckbMatchCase.Checked;
 			d.Add (ckbMatchCase);
 
 			var ckbMatchWholeWord = new CheckBox ("Match _whole word") {
@@ -848,7 +848,7 @@ namespace UICatalog.Scenarios {
 				Y = Pos.Top (ckbMatchCase) + 1,
 				Checked = _matchWholeWord
 			};
-			ckbMatchWholeWord.Toggled += (e) => _matchWholeWord = (bool)ckbMatchWholeWord.Checked;
+			ckbMatchWholeWord.Toggled += (s, e) => _matchWholeWord = (bool)ckbMatchWholeWord.Checked;
 			d.Add (ckbMatchWholeWord);
 
 			d.Width = label.Width + txtToFind.Width + btnFindNext.Width + 2;
@@ -860,7 +860,7 @@ namespace UICatalog.Scenarios {
 		private View ReplaceTab ()
 		{
 			var d = new View ();
-			d.DrawContent += (e) => {
+			d.DrawContent += (s,e) => {
 				foreach (var v in d.Subviews) {
 					v.SetNeedsDisplay ();
 				}
@@ -882,7 +882,7 @@ namespace UICatalog.Scenarios {
 				Y = Pos.Top (label),
 				Width = 20
 			};
-			txtToFind.Enter += (_) => txtToFind.Text = _textToFind;
+			txtToFind.Enter += (s, e) => txtToFind.Text = _textToFind;
 			d.Add (txtToFind);
 
 			var btnFindNext = new Button ("Replace _Next") {
@@ -894,7 +894,7 @@ namespace UICatalog.Scenarios {
 				IsDefault = true,
 				AutoSize = false
 			};
-			btnFindNext.Clicked += () => ReplaceNext ();
+			btnFindNext.Clicked += (s,e) => ReplaceNext ();
 			d.Add (btnFindNext);
 
 			label = new Label ("Replace:") {
@@ -911,7 +911,7 @@ namespace UICatalog.Scenarios {
 				Y = Pos.Top (label),
 				Width = 20
 			};
-			txtToReplace.TextChanged += (e) => _textToReplace = txtToReplace.Text.ToString ();
+			txtToReplace.TextChanged += (s, e) => _textToReplace = txtToReplace.Text.ToString ();
 			d.Add (txtToReplace);
 
 			var btnFindPrevious = new Button ("Replace _Previous") {
@@ -922,7 +922,7 @@ namespace UICatalog.Scenarios {
 				TextAlignment = TextAlignment.Centered,
 				AutoSize = false
 			};
-			btnFindPrevious.Clicked += () => ReplacePrevious ();
+			btnFindPrevious.Clicked += (s,e) => ReplacePrevious ();
 			d.Add (btnFindPrevious);
 
 			var btnReplaceAll = new Button ("Replace _All") {
@@ -933,10 +933,10 @@ namespace UICatalog.Scenarios {
 				TextAlignment = TextAlignment.Centered,
 				AutoSize = false
 			};
-			btnReplaceAll.Clicked += () => ReplaceAll ();
+			btnReplaceAll.Clicked += (s,e) => ReplaceAll ();
 			d.Add (btnReplaceAll);
 
-			txtToFind.TextChanged += (e) => {
+			txtToFind.TextChanged += (s, e) => {
 				_textToFind = txtToFind.Text.ToString ();
 				_textView.FindTextChanged ();
 				btnFindNext.Enabled = !txtToFind.Text.IsEmpty;
@@ -951,7 +951,7 @@ namespace UICatalog.Scenarios {
 				TextAlignment = TextAlignment.Centered,
 				AutoSize = false
 			};
-			btnCancel.Clicked += () => {
+			btnCancel.Clicked += (s,e) => {
 				DisposeWinDialog ();
 			};
 			d.Add (btnCancel);
@@ -961,7 +961,7 @@ namespace UICatalog.Scenarios {
 				Y = Pos.Top (txtToFind) + 2,
 				Checked = _matchCase
 			};
-			ckbMatchCase.Toggled += (e) => _matchCase = (bool)ckbMatchCase.Checked;
+			ckbMatchCase.Toggled += (s, e) => _matchCase = (bool)ckbMatchCase.Checked;
 			d.Add (ckbMatchCase);
 
 			var ckbMatchWholeWord = new CheckBox ("Match _whole word") {
@@ -969,7 +969,7 @@ namespace UICatalog.Scenarios {
 				Y = Pos.Top (ckbMatchCase) + 1,
 				Checked = _matchWholeWord
 			};
-			ckbMatchWholeWord.Toggled += (e) => _matchWholeWord = (bool)ckbMatchWholeWord.Checked;
+			ckbMatchWholeWord.Toggled += (s, e) => _matchWholeWord = (bool)ckbMatchWholeWord.Checked;
 			d.Add (ckbMatchWholeWord);
 
 			d.Width = lblWidth + txtToFind.Width + btnFindNext.Width + 2;

+ 10 - 10
UICatalog/Scenarios/Frames.cs

@@ -39,7 +39,7 @@ namespace UICatalog.Scenarios {
 					Y = 0,
 					Width = 5
 				};
-				topEdit.TextChanging += (e) => {
+				topEdit.TextChanging += (s, e) => {
 					try {
 						Thickness = new Thickness (Thickness.Left,
 							int.Parse (e.NewText.ToString ()), Thickness.Right,
@@ -59,7 +59,7 @@ namespace UICatalog.Scenarios {
 					Y = Pos.Bottom (topEdit),
 					Width = 5
 				};
-				leftEdit.TextChanging += (e) => {
+				leftEdit.TextChanging += (s, e) => {
 					try {
 						Thickness = new Thickness (int.Parse (e.NewText.ToString ()),
 							Thickness.Top, Thickness.Right,
@@ -78,7 +78,7 @@ namespace UICatalog.Scenarios {
 					Y = Pos.Bottom (topEdit),
 					Width = 5
 				};
-				rightEdit.TextChanging += (e) => {
+				rightEdit.TextChanging += (s, e) => {
 					try {
 						Thickness = new Thickness (Thickness.Left,
 							Thickness.Top, int.Parse (e.NewText.ToString ()),
@@ -97,7 +97,7 @@ namespace UICatalog.Scenarios {
 					Y = Pos.Bottom (leftEdit),
 					Width = 5
 				};
-				bottomEdit.TextChanging += (e) => {
+				bottomEdit.TextChanging += (s, e) => {
 					try {
 						Thickness = new Thickness (Thickness.Left,
 							Thickness.Top, Thickness.Right,
@@ -115,7 +115,7 @@ namespace UICatalog.Scenarios {
 					X = Pos.Center (),
 					Y = Pos.AnchorEnd (1)
 				};
-				copyTop.Clicked += () => {
+				copyTop.Clicked += (s, e) => {
 					Thickness = new Thickness (Thickness.Top);
 					if (topEdit.Text.IsEmpty) {
 						topEdit.Text = "0";
@@ -183,7 +183,7 @@ namespace UICatalog.Scenarios {
 				};
 				Add (rbBorderStyle);
 
-				rbBorderStyle.SelectedItemChanged += (e) => {
+				rbBorderStyle.SelectedItemChanged += (s, e) => {
 					viewToEdit.BorderFrame.BorderStyle = (BorderStyle)e.SelectedItem;
 					viewToEdit.SetNeedsDisplay ();
 				};
@@ -200,7 +200,7 @@ namespace UICatalog.Scenarios {
 				//	Y = 6,
 				//	SelectedItem = (int)viewToEdit.Border.BackgroundColor
 				//};
-				//rbBackground.SelectedItemChanged += (e) => {
+				//rbBackground.SelectedItemChanged += (s, e) => {
 				//	if (viewToEdit.Border != null) {
 				//		viewToEdit.Border.BackgroundColor = (Color)e.SelectedItem;
 				//	}
@@ -219,7 +219,7 @@ namespace UICatalog.Scenarios {
 				//	Y = 6,
 				//	SelectedItem = (int)viewToEdit.Border.ForgroundColor
 				//};
-				//rbBorderBrush.SelectedItemChanged += (e) => {
+				//rbBorderBrush.SelectedItemChanged += (s, e) => {
 				//	if (viewToEdit.Border != null) {
 				//		viewToEdit.Border.ForgroundColor = (Color)e.SelectedItem;
 				//	}
@@ -252,7 +252,7 @@ namespace UICatalog.Scenarios {
 				X = Pos.Center (),
 				Y = Pos.Center (),
 			};
-			button.Clicked += () => MessageBox.Query (20, 7, "Hi", $"I'm a {view.GetType().Name}?", "Yes", "No");
+			button.Clicked += (s, e) => MessageBox.Query (20, 7, "Hi", $"I'm a {view.GetType().Name}?", "Yes", "No");
 			var label = new Label ($"I'm a {view.GetType ().Name}") {
 				X = Pos.Center (),
 				Y = Pos.Center () - 1,
@@ -273,7 +273,7 @@ namespace UICatalog.Scenarios {
 			view.Margin.ColorScheme = Colors.ColorSchemes ["Dialog"];
 
 			view.Add (tf1, button, label, tf2, tv);
-			view.LayoutComplete += (a) => view.Title = view.ToString ();
+			view.LayoutComplete += (s, e) => view.Title = view.ToString ();
 
 			var editor = new FramesEditor (
 				$"{Application.QuitKey} to Quit - Scenario: {GetName ()}",

+ 2 - 2
UICatalog/Scenarios/HexEditor.cs

@@ -64,7 +64,7 @@ namespace UICatalog.Scenarios {
 			Application.Top.Add (statusBar);
 		}
 
-		private void _hexView_PositionChanged (HexView.HexViewEventArgs obj)
+		private void _hexView_PositionChanged (object sender, HexViewEventArgs obj)
 		{
 			siPositionChanged.Title = $"Position: {obj.Position} Line: {obj.CursorPosition.Y} Col: {obj.CursorPosition.X} Line length: {obj.BytesPerLine}";
 			statusBar.SetNeedsDisplay ();
@@ -75,7 +75,7 @@ namespace UICatalog.Scenarios {
 			_hexView.AllowEdits = (bool)(miAllowEdits.Checked = !miAllowEdits.Checked);
 		}
 
-		private void _hexView_Edited (System.Collections.Generic.KeyValuePair<long, byte> obj)
+		private void _hexView_Edited (object sender, HexViewEditEventArgs e)
 		{
 			_saved = false;
 		}

+ 3 - 3
UICatalog/Scenarios/InteractiveTree.cs

@@ -49,7 +49,7 @@ namespace UICatalog.Scenarios {
 
 		}
 
-		private void TreeView_KeyPress (View.KeyEventEventArgs obj)
+		private void TreeView_KeyPress (object sender, KeyEventEventArgs obj)
 		{
 			if (obj.KeyEvent.Key == Key.DeleteChar) {
 
@@ -116,9 +116,9 @@ namespace UICatalog.Scenarios {
 			bool okPressed = false;
 
 			var ok = new Button ("Ok", is_default: true);
-			ok.Clicked += () => { okPressed = true; Application.RequestStop (); };
+			ok.Clicked += (s,e) => { okPressed = true; Application.RequestStop (); };
 			var cancel = new Button ("Cancel");
-			cancel.Clicked += () => { Application.RequestStop (); };
+			cancel.Clicked += (s,e) => { Application.RequestStop (); };
 			var d = new Dialog (title, 60, 20, ok, cancel);
 
 			var lbl = new Label () {

+ 1 - 1
UICatalog/Scenarios/InvertColors.cs

@@ -33,7 +33,7 @@ namespace UICatalog.Scenarios {
 				X = Pos.Center (),
 				Y = foreColors.Length + 1,
 			};
-			button.Clicked += () => {
+			button.Clicked += (s,e) => {
 
 				foreach (var label in labels) {
 					var color = label.ColorScheme.Normal;

+ 4 - 4
UICatalog/Scenarios/Keys.cs

@@ -95,7 +95,7 @@ namespace UICatalog.Scenarios {
 			};
 			Win.Add (labelKeypress);
 
-			Win.KeyPress += (a) => labelKeypress.Text = a.KeyEvent.ToString ();
+			Win.KeyPress += (s,e) => labelKeypress.Text = e.KeyEvent.ToString ();
 
 			// Key stroke log:
 			var keyLogLabel = new Label ("Key stroke log:") {
@@ -172,9 +172,9 @@ namespace UICatalog.Scenarios {
 				Height = Dim.Fill (),
 			};
 
-			Win.KeyDown += (a) => KeyDownPressUp (a.KeyEvent, "Down");
-			Win.KeyPress += (a) => KeyDownPressUp (a.KeyEvent, "Press");
-			Win.KeyUp += (a) => KeyDownPressUp (a.KeyEvent, "Up");
+			Win.KeyDown += (s,a) => KeyDownPressUp (a.KeyEvent, "Down");
+			Win.KeyPress += (s, a) => KeyDownPressUp (a.KeyEvent, "Press");
+			Win.KeyUp += (s, a) => KeyDownPressUp (a.KeyEvent, "Up");
 
 			void KeyDownPressUp (KeyEvent keyEvent, string updown)
 			{

+ 15 - 15
UICatalog/Scenarios/LabelsAsButtons.cs

@@ -32,14 +32,14 @@ namespace UICatalog.Scenarios {
 				HotKeySpecifier = (System.Rune)'_',
 				CanFocus = true,
 			};
-			defaultLabel.Clicked += () => Application.RequestStop ();
+			defaultLabel.Clicked += (s,e) => Application.RequestStop ();
 			Win.Add (defaultLabel);
 
 			var swapLabel = new Label (50, 0, "S_wap Default (Absolute Layout)") {
 				HotKeySpecifier = (System.Rune)'_',
 				CanFocus = true,
 			};
-			swapLabel.Clicked += () => {
+			swapLabel.Clicked += (s,e) => {
 				//defaultLabel.IsDefault = !defaultLabel.IsDefault;
 				//swapLabel.IsDefault = !swapLabel.IsDefault;
 			};
@@ -47,7 +47,7 @@ namespace UICatalog.Scenarios {
 
 			static void DoMessage (Label Label, ustring txt)
 			{
-				Label.Clicked += () => {
+				Label.Clicked += (s,e) => {
 					var btnText = Label.Text.ToString ();
 					MessageBox.Query ("Message", $"Did you click {txt}?", "Yes", "No");
 				};
@@ -73,7 +73,7 @@ namespace UICatalog.Scenarios {
 				Win.Add (colorLabel);
 				x += colorLabel.Text.Length + 2;
 			}
-			Application.Top.Ready += () => Application.Top.Redraw (Application.Top.Bounds);
+			Application.Top.Ready += (s,e) => Application.Top.Redraw (Application.Top.Bounds);
 
 			Label Label;
 			Win.Add (Label = new Label ("A super long _Label that will probably expose a bug in clipping or wrapping of text. Will it?") {
@@ -93,7 +93,7 @@ namespace UICatalog.Scenarios {
 				TextAlignment = TextAlignment.Centered,
 				VerticalTextAlignment = VerticalTextAlignment.Middle
 			});
-			Label.Clicked += () => MessageBox.Query ("Message", "Question?", "Yes", "No");
+			Label.Clicked += (s,e) => MessageBox.Query ("Message", "Question?", "Yes", "No");
 
 			var textChanger = new Label ("Te_xt Changer") {
 				X = 2,
@@ -102,7 +102,7 @@ namespace UICatalog.Scenarios {
 				CanFocus = true,
 			};
 			Win.Add (textChanger);
-			textChanger.Clicked += () => textChanger.Text += "!";
+			textChanger.Clicked += (s,e) => textChanger.Text += "!";
 
 			Win.Add (Label = new Label ("Lets see if this will move as \"Text Changer\" grows") {
 				X = Pos.Right (textChanger) + 2,
@@ -120,7 +120,7 @@ namespace UICatalog.Scenarios {
 			};
 			Win.Add (removeLabel);
 			// This in interesting test case because `moveBtn` and below are laid out relative to this one!
-			removeLabel.Clicked += () => {
+			removeLabel.Clicked += (s,e) => {
 				// Now this throw a InvalidOperationException on the TopologicalSort method as is expected.
 				//Win.Remove (removeLabel);
 
@@ -145,7 +145,7 @@ namespace UICatalog.Scenarios {
 				HotKeySpecifier = (System.Rune)'_',
 				CanFocus = true,
 			};
-			moveBtn.Clicked += () => {
+			moveBtn.Clicked += (s,e) => {
 				moveBtn.X = moveBtn.Frame.X + 5;
 				// This is already fixed with the call to SetNeedDisplay() in the Pos Dim.
 				//computedFrame.LayoutSubviews (); // BUGBUG: This call should not be needed. View.X is not causing relayout correctly
@@ -163,7 +163,7 @@ namespace UICatalog.Scenarios {
 				CanFocus = true,
 				AutoSize = false
 			};
-			sizeBtn.Clicked += () => {
+			sizeBtn.Clicked += (s,e) => {
 				sizeBtn.Width = sizeBtn.Frame.Width + 5;
 				//computedFrame.LayoutSubviews (); // FIXED: This call should not be needed. View.X is not causing relayout correctly
 			};
@@ -183,7 +183,7 @@ namespace UICatalog.Scenarios {
 				HotKeySpecifier = (System.Rune)'_',
 				CanFocus = true,
 			};
-			moveBtnA.Clicked += () => {
+			moveBtnA.Clicked += (s,e) => {
 				moveBtnA.Frame = new Rect (moveBtnA.Frame.X + 5, moveBtnA.Frame.Y, moveBtnA.Frame.Width, moveBtnA.Frame.Height);
 			};
 			absoluteFrame.Add (moveBtnA);
@@ -195,7 +195,7 @@ namespace UICatalog.Scenarios {
 				CanFocus = true,
 				AutoSize = false
 			};
-			sizeBtnA.Clicked += () => {
+			sizeBtnA.Clicked += (s,e) => {
 				sizeBtnA.Frame = new Rect (sizeBtnA.Frame.X, sizeBtnA.Frame.Y, sizeBtnA.Frame.Width + 5, sizeBtnA.Frame.Height);
 			};
 			absoluteFrame.Add (sizeBtnA);
@@ -250,7 +250,7 @@ namespace UICatalog.Scenarios {
 				HotKeySpecifier = (System.Rune)'_',
 				CanFocus = true,
 			};
-			moveHotKeyBtn.Clicked += () => {
+			moveHotKeyBtn.Clicked += (s,e) => {
 				moveHotKeyBtn.Text = MoveHotkey (moveHotKeyBtn.Text);
 			};
 			Win.Add (moveHotKeyBtn);
@@ -264,12 +264,12 @@ namespace UICatalog.Scenarios {
 				HotKeySpecifier = (System.Rune)'_',
 				CanFocus = true,
 			};
-			moveUnicodeHotKeyBtn.Clicked += () => {
+			moveUnicodeHotKeyBtn.Clicked += (s,e) => {
 				moveUnicodeHotKeyBtn.Text = MoveHotkey (moveUnicodeHotKeyBtn.Text);
 			};
 			Win.Add (moveUnicodeHotKeyBtn);
 
-			radioGroup.SelectedItemChanged += (args) => {
+			radioGroup.SelectedItemChanged += (s,args) => {
 				switch (args.SelectedItem) {
 				case 0:
 					moveBtn.TextAlignment = TextAlignment.Left;
@@ -306,7 +306,7 @@ namespace UICatalog.Scenarios {
 				}
 			};
 
-			Application.Top.Ready += () => radioGroup.Refresh ();
+			Application.Top.Ready += (s,e) => radioGroup.Refresh ();
 		}
 	}
 }

+ 11 - 11
UICatalog/Scenarios/ListViewWithSelection.cs

@@ -62,7 +62,7 @@ namespace UICatalog.Scenarios {
 
 			var _scrollBar = new ScrollBarView (_listView, true);
 
-			_scrollBar.ChangedPosition += () => {
+			_scrollBar.ChangedPosition += (s,e) => {
 				_listView.TopItem = _scrollBar.Position;
 				if (_listView.TopItem != _scrollBar.Position) {
 					_scrollBar.Position = _listView.TopItem;
@@ -70,7 +70,7 @@ namespace UICatalog.Scenarios {
 				_listView.SetNeedsDisplay ();
 			};
 
-			_scrollBar.OtherScrollBarView.ChangedPosition += () => {
+			_scrollBar.OtherScrollBarView.ChangedPosition += (s,e) => {
 				_listView.LeftItem = _scrollBar.OtherScrollBarView.Position;
 				if (_listView.LeftItem != _scrollBar.OtherScrollBarView.Position) {
 					_scrollBar.OtherScrollBarView.Position = _listView.LeftItem;
@@ -78,7 +78,7 @@ namespace UICatalog.Scenarios {
 				_listView.SetNeedsDisplay ();
 			};
 
-			_listView.DrawContent += (e) => {
+			_listView.DrawContent += (s,e) => {
 				_scrollBar.Size = _listView.Source.Count - 1;
 				_scrollBar.Position = _listView.TopItem;
 				_scrollBar.OtherScrollBarView.Size = _listView.Maxlength - 1;
@@ -93,11 +93,11 @@ namespace UICatalog.Scenarios {
 				X = Pos.AnchorEnd (k.Length + 3),
 				Y = 0,
 			};
-			keepCheckBox.Toggled += (_) => _scrollBar.KeepContentAlwaysInViewport = (bool)keepCheckBox.Checked;
+			keepCheckBox.Toggled += (s,e) => _scrollBar.KeepContentAlwaysInViewport = (bool)keepCheckBox.Checked;
 			Win.Add (keepCheckBox);
 		}
 
-		private void ListView_RowRender (ListViewRowEventArgs obj)
+		private void ListView_RowRender (object sender, ListViewRowEventArgs obj)
 		{
 			if (obj.Row == _listView.SelectedItem) {
 				return;
@@ -113,9 +113,9 @@ namespace UICatalog.Scenarios {
 			}
 		}
 
-		private void _customRenderCB_Toggled (bool? prev)
+		private void _customRenderCB_Toggled (object sender, ToggleEventArgs e)
 		{
-			if (prev == true) {
+			if (e.OldValue == true) {
 				_listView.SetSource (_scenarios);
 			} else {
 				_listView.Source = new ScenarioListDataSource (_scenarios);
@@ -124,16 +124,16 @@ namespace UICatalog.Scenarios {
 			Win.SetNeedsDisplay ();
 		}
 
-		private void AllowMarkingCB_Toggled (bool? prev)
+		private void AllowMarkingCB_Toggled (object sender, ToggleEventArgs e)
 		{
-			_listView.AllowsMarking = (bool)!prev;
+			_listView.AllowsMarking = (bool)!e.OldValue;
 			_allowMultipleCB.Visible = _listView.AllowsMarking;
 			Win.SetNeedsDisplay ();
 		}
 
-		private void AllowMultipleCB_Toggled (bool? prev)
+		private void AllowMultipleCB_Toggled (object sender, ToggleEventArgs e)
 		{
-			_listView.AllowsMultipleSelection = (bool)!prev;
+			_listView.AllowsMultipleSelection = (bool)!e.OldValue;
 			Win.SetNeedsDisplay ();
 		}
 

Some files were not shown because too many files changed in this diff