Example #1
0
        public CollapsedPropertyGroup(object obj)
        {
            AddToClassList("collapsedPropertyGroup");

            Add(new Span("{"));

            var  properties = PropertyUtils.GetPropertyInfo(obj).ToList();
            bool isClipped  = properties.Count > Config.ShowMaxCollapsedProperties;

            properties = properties.Take(Config.ShowMaxCollapsedProperties).ToList();

            int i = 0;

            foreach (var property in properties)
            {
                if (i != 0)
                {
                    Add(new Span(", "));
                }

                Add(new PropertyValueGroup(property, new ViewContext {
                    Mode = ViewMode.Value
                }));
                i++;
            }

            if (isClipped)
            {
                var expander = new Span(", (...)");
                Add(expander);
            }

            Add(new Span("}"));
        }
        public ExpandedPropertyGroup(object obj)
        {
            AddToClassList("expandedPropertyGroup");

            //
            // Properties
            var  properties = PropertyUtils.GetPropertyInfo(obj).ToList();
            bool isClipped  = properties.Count > Config.ShowMaxBlockProperties;

            properties = properties.Take(Config.ShowMaxBlockProperties).ToList();

            foreach (var property in properties)
            {
                Add(new PropertyValueGroup(property, new ViewContext {
                    Mode = ViewMode.Default
                }));
            }

            if (isClipped)
            {
                var expander = new Span("(...)");
                Add(expander);
            }
        }