diff --git a/Perspex/Styling/Activator.cs b/Perspex/Styling/Activator.cs index 29a7d117b5..80a2fe94db 100644 --- a/Perspex/Styling/Activator.cs +++ b/Perspex/Styling/Activator.cs @@ -21,27 +21,22 @@ namespace Perspex.Styling bool last = false; - public Activator(Match match) + public Activator(IEnumerable> inputs) { int i = 0; - while (match != null) + foreach (IObservable input in inputs) { int iCaptured = i; - if (match.Observable != null) - { - this.values.Add(false); - - IDisposable subscription = match.Observable.Subscribe( - x => this.Update(iCaptured, x), - x => this.Finish(iCaptured), - () => this.Finish(iCaptured)); - this.subscriptions.Add(subscription); - ++i; - } + this.values.Add(false); - match = match.Previous; + IDisposable subscription = input.Subscribe( + x => this.Update(iCaptured, x), + x => this.Finish(iCaptured), + () => this.Finish(iCaptured)); + this.subscriptions.Add(subscription); + ++i; } } diff --git a/Perspex/Styling/Match.cs b/Perspex/Styling/Match.cs index dc8304129a..44cc78cf92 100644 --- a/Perspex/Styling/Match.cs +++ b/Perspex/Styling/Match.cs @@ -76,7 +76,20 @@ namespace Perspex.Styling public Activator GetActivator() { - return new Activator(this); + List> inputs = new List>(); + Match match = this; + + while (match != null) + { + if (match.Observable != null) + { + inputs.Add(match.Observable); + } + + match = match.Previous; + } + + return new Activator(inputs); } public override string ToString()