silverlightpivotviewer

Programmatically set the PivotViewer's filters


I have a Silverlight PivotViewer up and running, with about 4000 items.

I pass querystring parameters to the page that hosts the PivotViewer, to filter the items upon opening.

How do you add filters to the PivotViewer programmatically?

I've tried :

pvtTest.AppliedFilters.Add(new KeyValuePair<string, IList<string>>("Color", new List<string> { "EQ.Green", "EQ.Red" }));

but it still displays all the items. I've also tried checking what the value of the AppliedFilters property is after I set some filters using the UI, but it still only contains the filter that I added above.


Solution

  • You can specify filters by using the ViewerState property.

    It has a very specific syntax, which can be found here.