/// <summary> /// Initializes a new instance of the <see cref="StyleKey"/> structure. /// </summary> /// <param name="name">The style's canonical name.</param> /// <param name="navigationExpression">The navigation expression for the style.</param> public StyleKey(String name, NavigationExpression?navigationExpression) { Contract.Require(name, nameof(name)); this.name = name; this.navigationExpression = navigationExpression; }
/// <summary> /// Adds a trigger to the prioritizer. /// </summary> /// <param name="uv">The Ultraviolet context.</param> /// <param name="selector">The selector which caused this style to be considered.</param> /// <param name="navigationExpression">The navigation expression associated with the style.</param> /// <param name="trigger">The trigger to add to the prioritizer.</param> /// <param name="index">The index of the trigger's rule set within the style sheet.</param> public void Add(UltravioletContext uv, UvssSelector selector, NavigationExpression?navigationExpression, UvssTrigger trigger, Int32 index) { Contract.Require(uv, nameof(uv)); var key = new StyleKey(trigger.CanonicalName, navigationExpression); var priority = CalculatePriorityFromSelector(selector, false); PrioritizedTrigger existing; if (!triggers.TryGetValue(key, out existing)) { triggers[key] = new PrioritizedTrigger(trigger, selector, priority, index); } else { var comparison = selector.ComparePriority(existing.Selector); if (comparison == 0 && index > existing.Index) { comparison = 1; } if (comparison > 0 && (trigger.IsImportant || !existing.Trigger.IsImportant)) { triggers[key] = new PrioritizedTrigger(trigger, selector, priority, index); } } }
/// <summary> /// Applies a style to the element. /// </summary> /// <param name="style">The style which is being applied.</param> /// <param name="selector">The selector which caused the style to be applied.</param> /// <param name="navigationExpression">The navigation expression associated with the style.</param> /// <param name="dprop">A <see cref="DependencyProperty"/> that identifies the dependency property which is being styled.</param> protected internal virtual void ApplyStyle(UvssRule style, UvssSelector selector, NavigationExpression?navigationExpression, DependencyProperty dprop) { if (dprop != null) { dprop.ApplyStyle(this, style); } }
/// <inheritdoc/> protected internal sealed override void ApplyStyle(UvssRule style, UvssSelector selector, NavigationExpression?navigationExpression, DependencyProperty dp) { base.ApplyStyle(style, selector, navigationExpression, dp); }
/// <summary> /// Initializes a new instance of the <see cref="StoryboardTargetAnimationKey"/> structure. /// </summary> /// <param name="propertyName">The name of the animated property.</param> /// <param name="navigationExpression">The navigation expression for the animated property, if one was specified.</param> public StoryboardTargetAnimationKey(DependencyName propertyName, NavigationExpression?navigationExpression = null) { this.propertyName = propertyName; this.navigationExpression = navigationExpression; }