Hi Carlos,
If you are using your custom comparer for PivotItems, all the items of filter popup are displayed in given order. If you are adding the pivot items into filters dynamically, your custom comparer will be applied for filter items also. At the same time, if you would like to add the filters programmatically and need to set the comparer for them, then you can achieve this by using Comparer property available in FilterItemsCollection class. Please refer to the following code example.
#MainPage.Xaml.cs
public MainWindow()
{
InitializeComponent();
pivotGrid1.PivotColumns[0].Comparer = new DayComparer();
pivotGrid1.Loaded += PivotGrid1_Loaded;
}
private void Filters_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
{
var fItem = e.NewItems[0] as FilterItemsCollection;
if (fItem != null && fItem.Name == "Week")
{
fItem.Comparer = new WeekComparer();
}
}
private void PivotGrid1_Loaded(object sender, RoutedEventArgs e)
{
pivotGrid1.GroupingBar.Filters.CollectionChanged += Filters_CollectionChanged;
} |
We have prepared a simple sample to achieve your requirement and it can be downloaded from below location.
Regards,
Sabaridass R