Sunday 18 November 2012

Programmatically setting the PivotViewer Filter

You can preconfigure the Silverlight PivotViewer to contain a filter in code, here is how. If you have a ‘CouponToday’ decimal property and wanted to set Greater than 5 and Less than 10:

using System.Windows;
using System.Windows.Controls.Pivot;

namespace PivotViewerDemo
{
public partial class MainPage
{
public MainPage()
{
InitializeComponent();

this.pivotViewer.ItemsSource = Factory.GetData();
this.pivotViewer.View = this.pivotViewer.GraphView;
this.pivotViewer.Loaded += pivotViewer_Loaded;
}

private void pivotViewer_Loaded(object sender, RoutedEventArgs e)
{
this.pivotViewer.Filter = "CouponToday=GE.5_LE.10";
}
}
}

image

No comments:

Post a Comment