How to push live data into a DataSource bound to the WPF PivotGrid?
Pushing live data updates into a DataSource of the WPF 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
Conclusion
I hope you enjoyed learning about how to push live data into a DataSource bound to the WPF PivotGrid.
You can refer to our WPF PivotGrid feature tour page to know about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications. You can also explore our WPF PivotGrid example to understand how to create and manipulate data.
For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.
If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!