private static IStyleValueAssignment ApplyDeclarationToDependencyProperty(IVisualElement visual, IDependencyProperty property, IStyleDeclaration declaration) { var declarationValue = GetDeclarationValue(declaration); switch (declarationValue) { case Func <IVisualElement, Object?> computed: return(new ComputedValueAssignment(visual, property, computed)); default: return(new AppliedValueAssignment(visual, property, declarationValue)); } }
public static Object?GetDeclarationValue(IStyleDeclaration declaration) { switch (declaration) { case TransformDeclaration xform: return(ConvertTransform(xform).Value); case IStyleValueDeclaration scalar: var res = scalar.Value; res = ConvertDeclarationValue(res); return(res); } throw new NotImplementedException(); }
private static IStyleValueAssignment?ApplyDeclarationToVisual(IVisualElement visual, IStyleDeclaration declaration) { if (visual.TryGetDependencyProperty(declaration.Property, out var dependencyProperty)) { //Debug.WriteLine("Setting " + visual.GetType().Name + "->" + dependencyProperty + // " = " + declaration); return(ApplyDeclarationToDependencyProperty(visual, dependencyProperty, declaration)); } //Debug.WriteLine("No dependency property found for " + declaration.Property + // " on " + visual); return(default);
public Boolean Equals(IStyleDeclaration other) { return(other.Property == Property && other is ObjectDeclaration obj && Equals(obj.Value, Value)); }