Category / Section
How to push live data into a DataSource bound to the PivotGrid?
1 min read
Pushing live data updates into a DataSource of the PivotGrid can be done by using the updating feature in the PivotGrid. Updating the calculation values based on the throttle rate that has been chosen, the PivotGrid is updated with new values every few milliseconds by using the timer function. This feature also helps to add new records in the PivotGrid. This can be achieved by setting the property, EnableUpdating to true. Refer to the following code example.
XAML
<Window x:Class="WpfApplication1.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Window1" Height="323" Width="500" xmlns:syncfusion="http://schemas.syncfusion.com/wpf" xmlns:local="clr-namespace:WpfApplication1"> <!--Specifies the DataSource in Window Resources--> <Window.Resources> <ResourceDictionary> <ObjectDataProvider x:Key="data" ObjectType="{x:Type local:ProductSales}" MethodName="GetSalesData"/> </ResourceDictionary> </Window.Resources> <Grid> <syncfusion:PivotGridControl HorizontalAlignment="Left" Name="PivotGridControl1" VerticalAlignment="Top" EnableValueEditing =”True" ItemSource="{Binding Source={StaticResource data}}" > </syncfusion:PivotGridControl> </Grid> </Window>
C#
public MainWindow() { InitializeComponent(); PivotGridControl pivotGrid1 = new PivotGridControl(); this.grid1.Children.Add(PivotGrid1); this.pivotGrid1.EnableValueEditing = true; }
VB
Public Sub MainWindow() InitializeComponent() Dim pivotGrid1 As New PivotGridControl() Me.grid1.Children.Add(PivotGrid1) Me.pivotGrid1. EnableValueEditing = True End Sub