示例#1
0
        /// <summary>
        /// Gets the control metadata.
        /// </summary>
        private ControlResolverMetadata BuildControlMetadata(ControlType type)
        {
            var attribute = type.Type.GetCustomAttribute<ControlMarkupOptionsAttribute>();

            var properties = GetControlProperties(type.Type);
            var metadata = new ControlResolverMetadata()
            {
                Name = type.Type.Name,
                Namespace = type.Type.Namespace,
                HasHtmlAttributesCollection = typeof(IControlWithHtmlAttributes).IsAssignableFrom(type.Type),
                Type = type.Type,
                ControlBuilderType = type.ControlBuilderType,
                Properties = properties,
                IsContentAllowed = attribute.AllowContent,
                VirtualPath = type.VirtualPath,
                DataContextConstraint = type.DataContextRequirement,
                DefaultContentProperty = attribute.DefaultContentProperty != null ? properties[attribute.DefaultContentProperty] : null
            };
            return metadata;
        }