Skip to content

Commit 704b9cc

Browse files
authored
Merge pull request #294 from enisn/4.1-checkbox-eventargs
Checkbox CheckChangedEventArgs
2 parents c560629 + ede3fae commit 704b9cc

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/InputKit.Maui/Shared/Controls/CheckBox.cs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ public CheckBox()
9191
UpdateShape();
9292
GestureRecognizers.Add(new TapGestureRecognizer
9393
{
94-
Command = new Command(() => { if (IsDisabled) return; IsChecked = !IsChecked; ExecuteCommand(); CheckChanged?.Invoke(this, new EventArgs()); ValidationChanged?.Invoke(this, new EventArgs()); }),
94+
Command = new Command(() => { if (IsDisabled) return; IsChecked = !IsChecked; ExecuteCommand(); CheckChanged?.Invoke(this, new CheckChangedEventArgs(IsChecked)); ValidationChanged?.Invoke(this, new EventArgs()); }),
9595
});
9696
}
9797

@@ -111,7 +111,7 @@ public CheckBox(string optionName, int key) : this()
111111
/// <summary>
112112
/// Invoked when check changed
113113
/// </summary>
114-
public event EventHandler CheckChanged;
114+
public event EventHandler<CheckChangedEventArgs> CheckChanged;
115115
public event EventHandler ValidationChanged;
116116
#endregion
117117

@@ -428,4 +428,14 @@ public enum CheckType
428428
Filled,
429429
Material,
430430
}
431+
432+
public class CheckChangedEventArgs
433+
{
434+
public CheckChangedEventArgs(bool value)
435+
{
436+
Value = value;
437+
}
438+
439+
public bool Value { get; }
440+
}
431441
}

0 commit comments

Comments
 (0)