protected internal override XamlMember GetProperty(PropertyInfo pi)
        {
            Type   objType = pi.DeclaringType;
            string name    = pi.Name;

            XamlMember result;

            var key = MemberKey.Create(pi, "p");

            if (_cachedMembers.TryGetValue(key, out result))
            {
                return(result);
            }

            var avProp = AvaloniaPropertyRegistry.Instance.FindRegistered(objType, name);

            if (avProp != null)
            {
                result = new AvaloniaPropertyXamlMember(avProp, pi, this);
            }

            if (result == null)
            {
                result = new PropertyXamlMember(pi, this);
            }

            return(_cachedMembers[key] = result);
        }
Пример #2
0
        protected override XamlMember LookupMember(string name, bool skipReadOnlyCheck)
        {
            var m = base.LookupMember(name, skipReadOnlyCheck);

            if (m == null)
            {
                //so far Portable.xaml haven't found the member/property
                //but what if we have AvaloniaProperty
                //without setter and/or without getter
                //let's try to find the AvaloniaProperty as a fallback
                var avProp = AvaloniaPropertyRegistry.Instance.FindRegistered(UnderlyingType, name);

                if (avProp != null && !(skipReadOnlyCheck && avProp.IsReadOnly))
                {
                    m = new AvaloniaPropertyXamlMember(avProp, this);
                }
            }

            return(m);
        }