public DependencyProperty(XamlAstClrProperty original, IXamlProperty dependencyPropertyProp,
                           WellKnownWinUITypes types)
     : base(original, original.Name, original.DeclaringType, original.Getter, original.Setters)
 {
     dependencyProperty = dependencyPropertyProp;
     Setters.Insert(0, new BindingSetter(types, original.DeclaringType, dependencyPropertyProp));
 }
Example #2
0
        public XamlIlAvaloniaProperty(XamlAstClrProperty original, IXamlField field,
                                      AvaloniaXamlIlWellKnownTypes types)
            : base(original, original.Name, original.DeclaringType, original.Getter, original.Setters)
        {
            var assignBinding = original.CustomAttributes.Any(ca => ca.Type.Equals(types.AssignBindingAttribute));

            AvaloniaProperty = field;
            CustomAttributes = original.CustomAttributes;
            if (!assignBinding)
            {
                Setters.Insert(0, new BindingSetter(types, original.DeclaringType, field));
            }

            // Styled and attached properties can be set with a BindingPriority when they're
            // assigned in a ControlTemplate.
            if (field.FieldType.GenericTypeDefinition == types.StyledPropertyT ||
                field.FieldType.GenericTypeDefinition == types.AvaloniaAttachedPropertyT)
            {
                var propertyType = field.FieldType.GenericArguments[0];
                Setters.Insert(0, new SetValueWithPrioritySetter(types, original.DeclaringType, field, propertyType));
                if (!assignBinding)
                {
                    Setters.Insert(1, new BindingWithPrioritySetter(types, original.DeclaringType, field));
                }
            }

            Setters.Insert(0, new UnsetValueSetter(types, original.DeclaringType, field));
        }
Example #3
0
        public XamlIlAvaloniaProperty(XamlIlAstClrProperty original, IXamlIlField field,
                                      AvaloniaXamlIlWellKnownTypes types)
            : base(original, original.Name, original.DeclaringType, original.Getter, original.Setters)
        {
            AvaloniaProperty = field;
            CustomAttributes = original.CustomAttributes;
            if (!original.CustomAttributes.Any(ca => ca.Type.Equals(types.AssignBindingAttribute)))
            {
                Setters.Insert(0, new BindingSetter(types, original.DeclaringType, field));
            }

            Setters.Insert(0, new UnsetValueSetter(types, original.DeclaringType, field));
        }