# grid-realtimeupdates

> GridControl with real-time data updates streaming stock quotes and changing cell values dynamically.

**Framework:** wpf  **Component:** Grid  **Variant:** realtimeupdates

## Get this item

**If you are an agent, fetch the JSON.** Source is inlined, so one request is enough and no tooling is required:

```
GET https://ai.syncfusion.com/r/wpf/grid-realtimeupdates.json
```

**Install Package(s)**

```bash
dotnet add package Syncfusion.SfGrid.WPF
```

**Notes**

- Syncfusion release: 2026 Volume 3 (v35.1.37)
- The Syncfusion package is licensed. The composition in this file is source you own and edit. See https://ai.syncfusion.com/licensing.md

## Source files

### src/components/grid-realtimeupdates/grid.xaml

```xaml
<UserControl x:Class="syncfusion.datagriddemos.wpf.RealTimeUpdates.Grid"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:syncfusion="http://schemas.syncfusion.com/wpf"
        xmlns:interactivity="http://schemas.microsoft.com/xaml/behaviors"
        xmlns:local="clr-namespace:syncfusion.datagriddemos.wpf.RealTimeUpdates"
        Unloaded="OnSampleUnloaded">
    <UserControl.Resources>
        <local:StockChangeConverter x:Key="stockChangeConverter" />
        <local:ChangeForegroundConverter x:Key="changeForegroundConverter" />
    </UserControl.Resources>
    <Grid Background="White">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>

        <!-- Information Header -->
        <Border Grid.Row="0" Background="#F5F5F5" Padding="12" BorderBrush="#E0E0E0" BorderThickness="0,0,0,1">
            <StackPanel>
                <TextBlock FontWeight="Bold" FontSize="14" Foreground="#333" Margin="0,0,0,5">
                    Real-Time Market Data Updates
                </TextBlock>
                <TextBlock FontSize="12" Foreground="#666">
                    Live stock market data with 50-100 random price updates every 500ms. Displays 500 real stocks from Technology, Finance, Healthcare, Energy, Consumer, and Industrial sectors. Watch prices fluctuate realistically (±0.5% to ±3.0% per update).
                </TextBlock>
            </StackPanel>
        </Border>

        <!-- Options -->
        <Border Grid.Row="1" Background="#FAFAFA" Padding="12" BorderBrush="#E0E0E0" BorderThickness="0,0,0,1">
            <StackPanel>
                <TextBlock x:Name="textBlock5" Margin="5" FontSize="12" FontWeight="Bold" Text="Timer Frequency:" />
                <Slider
                    x:Name="trackTimer"
                    Margin="5"
                    Maximum="1000"
                    Minimum="100"
                    TickFrequency="1"
                    TickPlacement="None"
                    Value="{Binding TimeSpanValue, Mode=TwoWay}" />

                <TextBlock x:Name="textBlock6" Margin="5" FontSize="12" FontWeight="Bold" Text="Start / Stop Timer:" />

                <Button
                    x:Name="btnTimer"
                    Width="160"
                    Height="25"
                    Margin="5"
                    HorizontalAlignment="Left"
                    Command="{Binding ButtonClickCommand}"
                    Content="{Binding ButtonContent}" />
            </StackPanel>
        </Border>

        <!-- Statistics Bar -->
        <Border Grid.Row="2" Background="#FAFAFA" Padding="12" BorderBrush="#E0E0E0" BorderThickness="0,0,0,1">
            <StackPanel Orientation="Horizontal">
                <StackPanel Orientation="Horizontal" Margin="0,0,20,0">
                    <TextBlock FontWeight="Bold" Foreground="#333" Margin="0,0,5,0">Session Time:</TextBlock>
                    <TextBlock Foreground="#666" Text="{Binding SessionTime}"/>
                </StackPanel>

                <StackPanel Orientation="Horizontal" Margin="0,0,20,0">
                    <TextBlock FontWeight="Bold" Foreground="#333" Margin="0,0,5,0">Ticks:</TextBlock>
                    <TextBlock Foreground="#666" Text="{Binding TickCount}"/>
                </StackPanel>

                <StackPanel Orientation="Horizontal" Margin="0,0,20,0">
                    <TextBlock FontWeight="Bold" Foreground="#333" Margin="0,0,5,0">Updates/Tick:</TextBlock>
                    <TextBlock Foreground="#666" Text="{Binding UpdatesThisTick}"/>
                </StackPanel>

                <StackPanel Orientation="Horizontal" Margin="0,0,20,0">
                    <TextBlock FontWeight="Bold" Foreground="#333" Margin="0,0,5,0">Total Updates:</TextBlock>
                    <TextBlock Foreground="#666" Text="{Binding TotalUpdates}"/>
                </StackPanel>

                <StackPanel Orientation="Horizontal">
                    <TextBlock FontWeight="Bold" Foreground="#333" Margin="0,0,5,0">Throughput:</TextBlock>
                    <TextBlock Foreground="#2E7D32" FontWeight="Bold" Text="{Binding UpdatesPerSecond}"/>
                </StackPanel>
            </StackPanel>
        </Border>

        <!-- Timer Frequency readout, mirroring the datagrid PerformanceDemo header -->
        <StackPanel Grid.Row="3" Margin="10,5,10,5" Orientation="Horizontal">
            <TextBlock x:Name="textBlock1" Text="Timer Frequency : " />
            <TextBlock x:Name="textBlock2" Margin="5,0,0,0" FontWeight="SemiBold">
                <Run Text="{Binding Value, ElementName=trackTimer}" />
                <Run Text="ms" />
            </TextBlock>
            <TextBlock x:Name="textBlock3" Margin="10,0,0,0" Text="Stocks Loaded : " />
            <TextBlock x:Name="textBlock4" Margin="5,0,0,0" FontWeight="SemiBold" Text="500" />
        </StackPanel>

        <!-- Stock Data Grid -->
        <syncfusion:SfDataGrid
            Grid.Row="4"
            x:Name="dataGrid"
            Margin="0"
            AllowSorting="False"
            AutoGenerateColumns="False"
            ColumnSizer="Star"
            ItemsSource="{Binding Stocks}"
            NavigationMode="Row">
            <syncfusion:SfDataGrid.Columns>
                <!-- Stock Identifier -->
                <syncfusion:GridTextColumn HeaderText="Symbol" MappingName="Symbol" AllowResizing="True" TextAlignment="Left" />
                <syncfusion:GridTextColumn HeaderText="Company" MappingName="Company" AllowResizing="True" />
                <syncfusion:GridTextColumn HeaderText="Sector" MappingName="Sector" AllowResizing="True" />

                <!-- Price Information -->
                <syncfusion:GridTextColumn HeaderText="Last Trade" MappingName="LastTrade" TextAlignment="Right" />

                <!-- Change column with arrow template, mirroring the datagrid PerformanceDemo -->
                <syncfusion:GridTemplateColumn MappingName="Change">
                    <syncfusion:GridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition />
                                    <ColumnDefinition />
                                </Grid.ColumnDefinitions>
                                <TextBlock
                                    x:Name="changeValue"
                                    Grid.Column="1"
                                    HorizontalAlignment="Center"
                                    FontSize="14"
                                    Foreground="{Binding Change, Converter={StaticResource changeForegroundConverter}, ConverterParameter={x:Reference Name=dataGrid}}"
                                    Text="{Binding Change}" />

                                <Path
                                    Width="12"
                                    Height="12"
                                    Margin="0,0,0,0"
                                    Data="{Binding Change, Converter={StaticResource stockChangeConverter}}"
                                    Fill="{Binding Foreground, ElementName=changeValue}"
                                    Stretch="Uniform">
                                    <Path.RenderTransform>
                                        <TransformGroup>
                                            <TransformGroup.Children>
                                                <RotateTransform Angle="0" />
                                                <ScaleTransform ScaleX="1" ScaleY="1" />
                                            </TransformGroup.Children>
                                        </TransformGroup>
                                    </Path.RenderTransform>
                                </Path>
                            </Grid>
                        </DataTemplate>
                    </syncfusion:GridTemplateColumn.CellTemplate>
                </syncfusion:GridTemplateColumn>

                <!-- Opening &amp; Range -->
                <syncfusion:GridTextColumn HeaderText="Open" MappingName="OpenPrice" TextAlignment="Right" />
                <syncfusion:GridTextColumn HeaderText="High" MappingName="HighPrice" TextAlignment="Right" />
                <syncfusion:GridTextColumn HeaderText="Low" MappingName="LowPrice" TextAlignment="Right" />

                <!-- Market Data -->
                <syncfusion:GridTextColumn HeaderText="Year High" MappingName="YearHigh" TextAlignment="Right" />
                <syncfusion:GridTextColumn HeaderText="Year Low" MappingName="YearLow" TextAlignment="Right" />
                <syncfusion:GridTextColumn HeaderText="Volume" MappingName="Volume" TextAlignment="Right" />
                <syncfusion:GridTextColumn HeaderText="Market Cap ($B)" MappingName="MarketCap" TextAlignment="Right" />
                <syncfusion:GridTextColumn HeaderText="P/E Ratio" MappingName="PE" TextAlignment="Right" />
                <syncfusion:GridTextColumn HeaderText="Dividend" MappingName="Dividend" TextAlignment="Right" />
            </syncfusion:SfDataGrid.Columns>
            <interactivity:Interaction.Behaviors>
                <local:DataGridRealTimeUpdateBehavior />
            </interactivity:Interaction.Behaviors>
        </syncfusion:SfDataGrid>
    </Grid>
</UserControl>
```
