public void AddConditionalAction(Func <T, bool> predicate, Action <CodeTriggerActor <T> > setters) { var actor = new CodeTriggerActor <T>(); setters(actor); var action = new ConditionalCodeTriggerAction <T>(Element, predicate, actor); conditionalActions.Add(action); action.Apply(null); }
protected void OnTrigger(DependencyProperty property) { var appliedSetters = lastAppliedAction == null ? null : new HashSet <object>(); foreach (var action in conditionalActions) { if (action.Apply(appliedSetters)) { lastAppliedAction?.Unapply(appliedSetters); lastAppliedAction = action; return; } } lastAppliedAction?.Unapply(null); }