Trigger Change event when changing the checked state
This commit is contained in:
parent
d58625129b
commit
589e848f44
|
@ -182,6 +182,24 @@ namespace Ooui
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected virtual bool TriggerEvent (string name)
|
||||||
|
{
|
||||||
|
List<TargetEventHandler> handlers = null;
|
||||||
|
lock (eventListeners) {
|
||||||
|
List<TargetEventHandler> hs;
|
||||||
|
if (eventListeners.TryGetValue (name, out hs)) {
|
||||||
|
handlers = new List<TargetEventHandler> (hs);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (handlers != null) {
|
||||||
|
var args = new TargetEventArgs ();
|
||||||
|
foreach (var h in handlers) {
|
||||||
|
h.Invoke (this, args);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
protected virtual bool TriggerEventFromMessage (Message message)
|
protected virtual bool TriggerEventFromMessage (Message message)
|
||||||
{
|
{
|
||||||
if (message.TargetId != Id)
|
if (message.TargetId != Id)
|
||||||
|
|
|
@ -40,7 +40,11 @@ namespace Ooui
|
||||||
|
|
||||||
public bool IsChecked {
|
public bool IsChecked {
|
||||||
get => GetBooleanAttribute ("checked");
|
get => GetBooleanAttribute ("checked");
|
||||||
set => SetBooleanAttributeProperty ("checked", value);
|
set {
|
||||||
|
if (SetBooleanAttributeProperty ("checked", value)) {
|
||||||
|
TriggerEvent ("change");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public double Minimum {
|
public double Minimum {
|
||||||
|
|
Loading…
Reference in New Issue