|
#MainWindow.xaml.cs
using Syncfusion.Windows.Controls.PivotGrid;
using System.Windows;
using Syncfusion.PivotAnalysis.Base;
using System.ComponentModel;
public MainWindow()
{
InitializeComponent();
pivotGrid1.PivotRows.CollectionChanged += PivotItems_CollectionChanged;
pivotGrid1.PivotColumns.CollectionChanged += PivotItems_CollectionChanged;
}
private void PivotItems_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
{
if(e.NewItems != null && e.NewItems[0] is PivotItem)
{
(e.NewItems[0] as PivotItem).Comparer = new ReverseOrderComparer();
if (pivotGrid1.PivotEngine != null && !DesignerProperties.GetIsInDesignMode(pivotGrid1))
{
pivotGrid1.PivotEngine.RaisePivotSchemaChangedEvent(new PivotSchemaChangedArgs());
}
}
}
|