Category / Section
How to achieve dynamic column or row creation in our Pivot Grid
1 min read
We are mainly concentrating PivotGrid for IEnumerable/DataTable which is best & specifically created for In-memory analytics. Hence, for In-Memory analytics, we strongly suggest you to check PivotGrid control.
XAML
<StackPanel Orientation="Vertical"> <Button Content="Add Column" Click="Button_Click" /> </StackPanel>
C#
private void Button_Click(object sender, RoutedEventArgs e) { this.pivotGrid1.PivotColumns.Add(new PivotItem { FieldHeader = "State", FieldMappingName = "State", TotalHeader = "Total" }); this.pivotGrid1.Refresh(); }
Figure: Normal Pivot Grid
Figure: Pivot Grid shows dynamically added column