PivotViewer is a new Silverlight control for visualizing and interacting with collections of data. The data collection must be a group of entities of the same type, described using the Collection XML schema, CXML. Virtuoso data will soon be easily exposed as a pivot collection using the upcoming FacetServiceToPivotBridge?.
This document shows how to set up a very simple Silverlight application that makes such collections available on the Web. You can also play with an existing sample instance.
In
This step adds a text box and a PivotViewer to the application.
MainPage.xaml
add the pivot namespace,
xmlns:pivot="clr-namespace:System.Windows.Pivot;assembly=System.Windows.Pivot"
<Grid x:Name="LayoutRoot" Background="White"> </Grid>
<Grid x:Name="LayoutRoot"> <Grid.RowDefinitions> <RowDefinition Height="40"/> <RowDefinition Height="40"/> <RowDefinition Height="*"/> </Grid.RowDefinitions> <Grid.ColumnDefinitions> <ColumnDefinition Width="600"/> <ColumnDefinition Width="*"/> </Grid.ColumnDefinitions> <TextBlock Text="Pivot Collection Viewer" Visibility="Visible" FontSize="20" Grid.Row="0" Grid.Column="0" HorizontalAlignment="Left" VerticalAlignment="Center"/> <TextBox Name="urlBox" Grid.Row="1" Width="500" Height="30" Text="{Binding Mode=OneWay}" KeyDown="urlBox_KeyDown" Grid.Column="0" ></TextBox> <TextBlock Text="Type in a collection URL" Grid.Row="1" Grid.Column="1" VerticalAlignment="Bottom"></TextBlock> <Border x:Name="ContentBorder" Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2"> <!-- The PivotViewer control --> <pivot:PivotViewer x:Name="PivotViewer" Visibility="Collapsed" /> </Border> </Grid>
Once the URL of a collection has been typed into the text box, the PivotViewer opens the collection and is made visible.
This is done using the urlBox_KeyDown
event handler.
We need to add this to the file,
.
MainPage.xaml.cs
and add references to: System.Windows.Pivot
System.Windows.Pivot.Model
System.Windows.Pivot.SharedUI
System.Windows.Pivot.StringResources
System.Windows.Pivot.Utilities
using System.Windows.Pivot;
to the "using" block.
private void urlBox_KeyDown(object sender, KeyEventArgs e) { if (e.Key == Key.Enter) PivotViewer.LoadCollection(urlBox.Text, string.Empty); PivotViewer.Visibility = Visibility.Visible; }
http://content.getpivot.com/Collections/dogbreeds/dogbreeds.cxml
into the text box.
Publish the project from
PivotTest.Web
in the Solution Explorer.
$VIRTUOSO_DIR/vsp/
folder of your Virtuoso Server instance.
/pivottest
and Physical Path to the new folder you have just created under $VIRTUOSO_DIR/vsp/
.
PivotTestTestPage.html
.
/DAV/<new WebDAV folder name>
.
PivotTestTestPage.html
.
Now load http://<your server instance>/pivottest
in your Web browser, and you should see the page you have just created.
CrossDomainPolicy.xml
clientaccesspolicy.xml
or crossdomain.xml
file allowing access from the site serving the Silverlight application.