public VisualStateSelector(IStyleSelector selector, VisualStateType stateType) : base((selector.GetHashCode() * 397) ^ (Int32)stateType) { BaseSelector = selector; StateType = stateType; }
public AssignedStyle(StyleSetterType setterType, VisualStateType type, Object?value = null) { SetterType = setterType; Type = type; Value = value; _hash = (Int32)setterType + ((Int32)type << 16); }
private IStyleRule Rule <TValue>(VisualStateType state, TValue value, DeclarationProperty declarationProperty) { return(new StyleValueRule(Select(state), new List <IStyleDeclaration> { new ValueDeclaration <TValue>(value, _variableAccessor, declarationProperty) })); }
public virtual Boolean TryGetValue(StyleSetterType setterType, VisualStateType type, out Object val) { foreach (var k in GetUniqueFlags <VisualStateType>(type)) { var key = new AssignedStyle(setterType, k); if (_setters.TryGetValue(key, out val !)) { return(true); } } val = default !;
public override void Add(StyleSetterType setterType, VisualStateType type, Object?value) { var key = new AssignedStyle(setterType, type, value); if (setterType == StyleSetterType.Transition) { var transitions = value as Transition[] ?? throw new ArgumentOutOfRangeException(nameof(value)); foreach (var trans in transitions) { var tranqui = new AssignedStyle(trans.SetterType, type, trans); _transitions[tranqui] = trans; } } else if (_transitions.TryGetValue(key, out var transition)) { if (!_setters.TryGetValue(key, out var existed)) { existed = null; } switch (value) { //case Thickness _: // var runningThickness = new ThicknessTransition(existed, transition, key, UpdateTransition); // runningThickness.Start(); // break; //case Double _: // var running = new DoubleTransition(existed, // transition, key, UpdateTransition); // running.Start(); // break; default: throw new NotImplementedException(); } } else { base.Add(setterType, type, value); } }
public T GetStyleSetter <T>(StyleSetterType setterType, VisualStateType type, IVisualElement element, IVisualLineage visualLineage) { if (TryGetStyleSetterImpl <T>(setterType, type, element, visualLineage, out var found)) { return(found); } if (type != VisualStateType.None && TryGetStyleSetterImpl(setterType, VisualStateType.None, element, visualLineage, out found)) { return(found); } return(_defaultStyle[setterType] is T good ? good : default !);
public void RegisterStyleSetter(IVisualElement element, StyleSetterType setterType, VisualStateType type, Object value) { if (!IsTypeValid(setterType, value)) { throw new ArgumentOutOfRangeException(nameof(value)); } if (!_elementStyles.TryGetValue(element.Id, out var style)) { style = new ElementStyle(element, this); _elementStyles[element.Id] = style; } style.Add(setterType, type, value); }
public PlanFoundMessage(VisualStateType visualState) { VisualState = visualState; }
public T GetStyleSetter <T>(StyleSetterType setterType, VisualStateType type, IVisualElement element, IVisualLineage visualLineage) { return(ThrowException <T>()); }
public void RegisterStyleSetter(IVisualElement element, StyleSetterType setterType, VisualStateType type, Object value) { ThrowException <Object>(); }
public static Boolean Contains(this VisualStateType type, VisualStateType value) { return((type & value) > VisualStateType.Active); }
private static VisualStateSelector Select(VisualStateType state) { return(new(AllStyleSelector.Instance, state)); }