<UserControl x:Class="SparkLinesInGridView.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:local="clr-namespace:SparkLinesInGridView"
    xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
    mc:Ignorable="d" d:DesignWidth="640" d:DesignHeight="480">
    <UserControl.Resources>
        <local:MyCellStyleSelector x:Key="cellStyleSelector" />
    </UserControl.Resources>

    <Grid x:Name="LayoutRoot">
        <telerik:RadGridView ItemsSource="{Binding Data}" AutoGenerateColumns="False" IsFilteringAllowed="False" CanUserSortColumns="False"
             ShowGroupPanel="False" Width="480" Height="480" HorizontalAlignment="Center">
            <telerik:RadGridView.Columns>
                <telerik:GridViewDataColumn DataMemberBinding="{Binding Name}" />
                <telerik:GridViewDataColumn DataMemberBinding="{Binding Change}" DataFormatString="{}{0:f4}" 
                                            CellStyleSelector="{StaticResource cellStyleSelector}" />
                <telerik:GridViewDataColumn DataMemberBinding="{Binding LastUpdate}" />
                <telerik:GridViewDataColumn DataMemberBinding="{Binding Trend}" >
                    <telerik:GridViewDataColumn.CellTemplate>
                        <DataTemplate>
                            <telerik:RadLinearSparkline ItemsSource="{Binding Trend}" Margin="0,2,0,2" Width="200" Height="20" />
                        </DataTemplate>
                    </telerik:GridViewDataColumn.CellTemplate>
                </telerik:GridViewDataColumn>
            </telerik:RadGridView.Columns>
        </telerik:RadGridView>
    </Grid>
</UserControl>
