Browse Source

InTemplateOf should only affect later selectors.

So return a copy of the match.
pull/4/head
grokys 12 years ago
parent
commit
f2a5b2cb73
  1. 8
      Perspex/Styling/Match.cs
  2. 7
      Perspex/Styling/Selectors.cs

8
Perspex/Styling/Match.cs

@ -20,6 +20,14 @@ namespace Perspex.Styling
this.Observables = new List<IObservable<bool>>();
}
public Match(Match source)
{
this.Control = source.Control;
this.InTemplate = source.InTemplate;
this.Observables = source.Observables;
this.SelectorString = SelectorString;
}
public IStyleable Control
{
get;

7
Perspex/Styling/Selectors.cs

@ -64,9 +64,12 @@ namespace Perspex.Styling
Contract.Requires<ArgumentNullException>(match != null);
match.Observables.Add(Observable.Return(match.Control.TemplatedParent is T));
match.InTemplate = true;
match.SelectorString += '%' + typeof(T).Name;
return match;
return new Match(match)
{
InTemplate = true,
};
}
public static Match OfType<T>(this Match match) where T : IStyleable

Loading…
Cancel
Save