New in version 1.4 of VIBlend Silverlight Controls is the ability to create a Pivot Table entirely in XAML.
As usual you have to specify which columns (data fields) from the data source will represent the pivot table's rows, columns and values fields.
Below is the full XAML required to declare a pivot table:
<UserControl x:Class="SilverlightApplication1.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"
mc:Ignorable="d"
d:DesignHeight="600" d:DesignWidth="800"
xmlns:viblend="clr-namespace:VIBlend.Silverlight.Controls;assembly=DataGrid">
<Grid x:Name="LayoutRoot" Background="White">
<viblend:DataGrid AutoGenerateColumns="True" PivotValuesOnRows="False" Name="dataGrid1" Height="200" Width="500">
<viblend:DataGrid.BoundPivotRows>
<viblend:BoundField DataField="Country" Text="Country"/>
<viblend:BoundField DataField="Region" Text="Region"/>
<viblend:BoundField DataField="City" Text="City"/>
</viblend:DataGrid.BoundPivotRows>
<viblend:DataGrid.BoundPivotColumns>
<viblend:BoundField DataField="ShipperCompany" Text="Shipper Company"/>
</viblend:DataGrid.BoundPivotColumns>
<viblend:DataGrid.BoundPivotValues>
<viblend:BoundValueField DataField="ExtendedPrice" Text="Count of Sales" Function="Count"/>
<viblend:BoundValueField DataField="ExtendedPrice" Text="Amount of Sales" Function="Sum"/>
<viblend:BoundValueField DataField="ExtendedPrice" Text="Avg Sale Amount" Function="Average"/>
</viblend:DataGrid.BoundPivotValues>
</viblend:DataGrid>
</Grid>
</UserControl>
After that simply bind to the data source by setting the ItemsSource property of the data grid control:
dataGrid1.ItemsSource = myData;
The result is a great looking pivot table with interactive drill down support.
VIBlend DataGrid for Silverlight uses a built-in OLAP engine to construct the pivot table. You can bind the DataGrid to any data source and easily build in-house Business Intelligence and reporting tools within minutes.