Browse Source

Merge pull request #2087 from AvaloniaUI/perf/property-selector-isregistered

[Perf] Don't call IsRegistered in PropertyEqualsSelector.
pull/2196/head
Steven Kirk 7 years ago
committed by GitHub
parent
commit
a5c91be4e8
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      src/Avalonia.Styling/Styling/PropertyEqualsSelector.cs

6
src/Avalonia.Styling/Styling/PropertyEqualsSelector.cs

@ -72,11 +72,7 @@ namespace Avalonia.Styling
/// <inheritdoc/> /// <inheritdoc/>
protected override SelectorMatch Evaluate(IStyleable control, bool subscribe) protected override SelectorMatch Evaluate(IStyleable control, bool subscribe)
{ {
if (!AvaloniaPropertyRegistry.Instance.IsRegistered(control, _property)) if (subscribe)
{
return SelectorMatch.False;
}
else if (subscribe)
{ {
return new SelectorMatch(control.GetObservable(_property).Select(v => Equals(v ?? string.Empty, _value))); return new SelectorMatch(control.GetObservable(_property).Select(v => Equals(v ?? string.Empty, _value)));
} }

Loading…
Cancel
Save