In this article we will learn about creating a Pivot Viewer control in Silverlight . Lets get started with a short description of what a PivotViewer Control is. For this example I have used the Silverlight 5 PivotViewer, since most of us would have Silverlight 5 right now . The Silverlight PivotViewer Control does not come by default with the Silverlight 4 toolkit. It has to be downloaded and installed separately . With Silverlight 5 one would get the PivotViewer by default . For Silverlight 4 it must be downloaded from the link shown below : http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=17747 Once installed , the PivotViewer gets installed in the path as shown below : C:\Program Files (x86)\Microsoft SDKs\Silverlight\v4.0\PivotViewer\Aug10 Hence forth I am using Silverlight 5 but similar steps needs to be followed for Silverlight 4. Add a reference to the below DLL as shown below : Let's start coding then . PivotViewer uses a special type of Collection called as Collection XML . We need to understand Collection XML in order to effectively work with PivotViewer . Collection XML (CXML) is the schema used to describe structured data to be displayed in the PivotViewer collection experience. We make use of a class called CxmlCollectionSource to bind to the ItemSource of the PivotViewer More Information on the CxmlCollectionSource can be found in the link below : http://msdn.microsoft.com/en-us/library/system.windows.controls.pivot.cxmlcollectionsource(v=vs.96).aspx Shown below is how the data is bound to the ItemSource property of the PivotViewer Control . The final code is below : _cxml = new CxmlCollectionSource(new Uri("http://www.xpert360.net/PDC2010/PDC2010.cxml", UriKind.Absolute)); pv1.PivotProperties = _cxml.ItemProperties.ToList(); pv1.ItemTemplates = _cxml.ItemTemplates; pv1.ItemsSource = _cxml.Items; Let's give it a run. Cheers
Related posts
HostForLIFE.eu is European Windows Hosting Provider which focuses on Windows Platform only. We deliver on-demand hosting solutions including Shared hosting, Reseller Hosting, Cloud Hosting, Dedicated Servers, and IT as a Service for companies of all sizes.
We have offered the latest Windows 2016 Hosting, ASP.NET Core 2.2.1 Hosting, ASP.NET MVC 6 Hosting and SQL 2017 Hosting.
Sign in