Category / Section
How to load the Pivot Grid with all of the data collapsed
1 min read
Initially pivotGrid internalGrid seems to be an empty. It gets filled only after the loaded Event executes. So, the CollapseAllGroup () code should be placed within the dispatcher event as shown below to make the pivot grid to load all the data collapsed.
C#
this.Dispatcher.BeginInvoke( System.Windows.Threading.DispatcherPriority.Normal, new Action( delegate() { this.pivotGrid1.CollapseAllGroup(); } )); Or you can call the ApplyTemplate() before calling CollapseAllGroup() method as shown below: this.pivotGrid1.ApplyTemplate(); this.pivotGrid1.CollapseAllGroup(); NOTE: Give the above code (ApplyTemplate()) snippet within the Constructor().
Example:
Figure: Pivot Grid shows all data collapsed