// Only pass rootObjectType if the member is being looked up on the root object
        internal override bool IsVisible(XamlMember member, XamlType rootObjectType)
        {
            if (member == null)
            {
                return(false);
            }

            Type allowProtectedForType = null;

            if (AllowProtectedMembersOnRoot && rootObjectType != null)
            {
                allowProtectedForType = rootObjectType.UnderlyingType;
            }

            // First check if the property setter is visible
            if (member.IsWriteVisibleTo(LocalAssembly, allowProtectedForType))
            {
                return(true);
            }

            // If the property setter is not visible, but the property getter is, treat the property
            // as if it were read-only
            if (member.IsReadOnly || (member.Type != null && member.Type.IsUsableAsReadOnly))
            {
                return(member.IsReadVisibleTo(LocalAssembly, allowProtectedForType));
            }

            return(false);
        }
Exemplo n.º 2
0
        internal override bool IsVisible(XamlMember member, XamlType rootObjectType)
        {
            if (member == null)
            {
                return(false);
            }
            Type accessingType = null;

            if (this.AllowProtectedMembersOnRoot && (rootObjectType != null))
            {
                accessingType = rootObjectType.UnderlyingType;
            }
            if (member.IsWriteVisibleTo(this.LocalAssembly, accessingType))
            {
                return(true);
            }
            if (!member.IsReadOnly && ((member.Type == null) || !member.Type.IsUsableAsReadOnly))
            {
                return(false);
            }
            return(member.IsReadVisibleTo(this.LocalAssembly, accessingType));
        }