protected override SelectorMatch Evaluate(IStyleable control, bool subscribe) { IStyleable templatedParent = control.TemplatedParent as IStyleable; if (templatedParent == null) { throw new InvalidOperationException( "Cannot call Template selector on control with null TemplatedParent."); } return(_parent.Match(templatedParent, subscribe) ?? SelectorMatch.True); }
protected override SelectorMatch Evaluate(IStyleable control, bool subscribe) { var controlParent = ((ILogical)control).LogicalParent; if (controlParent != null) { return(_parent.Match((IStyleable)controlParent, subscribe)); } else { return(SelectorMatch.False); } }
protected override SelectorMatch Evaluate(IStyleable control, bool subscribe) { ILogical c = (ILogical)control; List <IObservable <bool> > descendantMatches = new List <IObservable <bool> >(); while (c != null) { c = c.LogicalParent; if (c is IStyleable) { var match = _parent.Match((IStyleable)c, subscribe); if (match.ImmediateResult != null) { if (match.ImmediateResult == true) { return(SelectorMatch.True); } } else { descendantMatches.Add(match.ObservableResult); } } } if (descendantMatches.Count > 0) { return(new SelectorMatch(StyleActivator.Or(descendantMatches))); } else { return(SelectorMatch.False); } }