/// <inheritdoc/> protected override SelectorMatch Evaluate(IStyleable control, bool subscribe) { if (subscribe) { return(new SelectorMatch(control.GetObservable(_property).Select(v => Equals(v ?? string.Empty, _value)))); } else { return(new SelectorMatch((control.GetValue(_property) ?? string.Empty).Equals(_value))); } }
protected override SelectorMatch Evaluate(IStyleable control, bool subscribe) { if (subscribe) { return(new SelectorMatch(new PropertyEqualsActivator(control, _property, _value))); } else { var result = (control.GetValue(_property) ?? string.Empty).Equals(_value); return(result ? SelectorMatch.AlwaysThisInstance : SelectorMatch.NeverThisInstance); } }
static Thickness Merge(IStyleable control, AvaloniaProperty <Thickness> property, Thickness newValue) { var oldValue = control.GetValue <Thickness>(property); return(new Thickness ( left: double.IsNaN(newValue.Left) ? oldValue.Left : newValue.Left, top: double.IsNaN(newValue.Top) ? oldValue.Top : newValue.Top, right: double.IsNaN(newValue.Right) ? oldValue.Right : newValue.Right, bottom: double.IsNaN(newValue.Bottom) ? oldValue.Bottom : newValue.Bottom )); }
protected override SelectorMatch Evaluate(IStyleable control, IStyle?parent, bool subscribe) { if (subscribe) { return(new SelectorMatch(new PropertyEqualsActivator(control, _property, _value))); } else { return(Compare(_property.PropertyType, control.GetValue(_property), _value) ? SelectorMatch.AlwaysThisInstance : SelectorMatch.NeverThisInstance); } }
/// <inheritdoc/> protected override SelectorMatch Evaluate(IStyleable control, bool subscribe) { if (!PerspexPropertyRegistry.Instance.IsRegistered(control, _property)) { return(SelectorMatch.False); } else if (subscribe) { return(new SelectorMatch(control.GetObservable(_property).Select(v => Equals(v, _value)))); } else { return(new SelectorMatch(control.GetValue(_property).Equals(_value))); } }
/// <inheritdoc/> protected override SelectorMatch Evaluate(IStyleable control, bool subscribe) { if (!AvaloniaPropertyRegistry.Instance.IsRegistered(control, _property)) { return SelectorMatch.False; } else if (subscribe) { return new SelectorMatch(control.GetObservable(_property).Select(v => Equals(v, _value))); } else { return new SelectorMatch(control.GetValue(_property).Equals(_value)); } }