예제 #1
0
        private IEnumerable <XAttribute> MakeFacetCategoryContent(FacetCategory cat)
        {
            yield return(new XAttribute("Name", cat.Name));

            yield return(new XAttribute("Type", FacetTypeText(cat.FacetType)));

            if (!string.IsNullOrEmpty(cat.DisplayFormat))
            {
                yield return(new XAttribute("Format", cat.DisplayFormat));
            }

            if (!cat.IsShowInFacetPane)
            {
                yield return(new XAttribute(PivotXmlns + "IsFilterVisible", false));
            }

            if (!cat.IsShowInInfoPane)
            {
                yield return(new XAttribute(PivotXmlns + "IsMetaDataVisible", false));
            }

            if (!cat.IsTextFilter)
            {
                yield return(new XAttribute(PivotXmlns + "IsWordWheelVisible", false));
            }
        }
예제 #2
0
        public void SetFacetDisplay(string category, bool showInFacetPane, bool showInInfoPane, bool isTextFilter)
        {
            FacetCategory cat = GetFacetCategory(category);

            cat.IsShowInFacetPane = showInFacetPane;
            cat.IsShowInInfoPane  = showInInfoPane;
            cat.IsTextFilter      = isTextFilter;
        }
예제 #3
0
        private FacetCategory GetFacetCategory(string category)
        {
            FacetCategory facetCategory = m_facetCategories.TryGet(category);

            if (null == facetCategory)
            {
                throw new ArgumentException("Facet category \"" + category + "\" has not been added.");
            }
            return(facetCategory);
        }
예제 #4
0
        private FacetCategory MakeFacetCategory(string category, FacetType facetType)
        {
            ThrowIfReservedCategoryName(category);

            FacetCategory facetCategory = m_facetCategories.TryGet(category);

            if (null != facetCategory)
            {
                if (facetCategory.FacetType != facetType)
                {
                    throw new ArgumentException(
                              string.Format("Facet category \"{0}\" already has type \"{1}\", which does not match the requested type \"{2}\".",
                                            facetCategory.Name, facetCategory.FacetType, facetType));
                }
            }
            else
            {
                facetCategory = new FacetCategory(category, facetType);
                m_facetCategories.Add(facetCategory);
            }
            return(facetCategory);
        }
예제 #5
0
        /// <summary>
        /// Set a format string for display of a numeric or datetime facet.
        /// Setting a format string for other facet types has no effect.
        /// Custom number formatting: http://msdn.microsoft.com/en-us/library/0c899ak8.aspx
        /// DateTime formatting: http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx
        /// </summary>
        public void SetFacetFormat(string category, string format)
        {
            FacetCategory cat = GetFacetCategory(category);

            cat.DisplayFormat = format;
        }