Example #1
0
        /// <summary>
        /// Take the values from the PivotKey and plug them into the unbound (i.e. name=null)
        /// parts of the PropertyPath.
        /// </summary>
        public static PropertyPath QualifyPropertyPath(PivotKey pivotKey, PropertyPath propertyPath)
        {
            if (pivotKey == null || propertyPath.IsRoot)
            {
                return(propertyPath);
            }
            var parent = QualifyPropertyPath(pivotKey, propertyPath.Parent);

            if (propertyPath.IsUnboundLookup)
            {
                object value = pivotKey.FindValue(propertyPath);
                if (null != value)
                {
                    return(parent.LookupByKey(value.ToString()));
                }
            }
            if (ReferenceEquals(parent, propertyPath.Parent))
            {
                return(propertyPath);
            }
            if (propertyPath.IsUnboundLookup)
            {
                return(parent.LookupAllItems());
            }
            if (propertyPath.IsProperty)
            {
                return(parent.Property(propertyPath.Name));
            }
            return(parent.LookupByKey(propertyPath.Name));
        }
Example #2
0
            public override object GetPropertyValue(RowItem rowItem, PivotKey pivotKey)
            {
                var collection = Parent.GetPropertyValue(rowItem, pivotKey);

                if (null == collection)
                {
                    return(null);
                }
                object key = rowItem.RowKey.FindValue(PropertyPath);

                if (null == key && null != pivotKey)
                {
                    key = pivotKey.FindValue(PropertyPath);
                }
                if (null == key)
                {
                    return(null);
                }
                return(_collectionInfo.GetItemFromKey(collection, key));
            }