I'm just playing around with PivotViewer control in Silverlight 5. It seems like many things got improved, but I'm having some issues displaying my old .cxml
collections that perfectly worked under Silverlight 4
The old way to code:
InitializeComponent();
MainPivotViewer.LoadCollection("http://localhost:4573/ClientBin/Actresses.cxml", string.Empty);
translates now to something like:
InitializeComponent();
CxmlCollectionSource _cxml = new CxmlCollectionSource(new Uri("http://localhost:1541/ClientBin/Actresses.cxml", UriKind.Absolute));
PivotMainPage.PivotProperties = _cxml.ItemProperties.ToList();
PivotMainPage.ItemTemplates = _cxml.ItemTemplates;
PivotMainPage.ItemsSource = _cxml.Items;
What happens is that Items are shown, but nothing shows up in the filter pane and, if an item is selected, there is no longer any description for them!
What is happening is that
_cxml.ItemsProperties
is not loaded until after theCxmlCollectionSource
downloads and processes the.cxml
file.CxmlCollectionSource
has aStateChanged
event. If you check to see if theState
isLoaded
, then you can map the_cxml
properties to the PivotViewer.Here is a sample of what this would look like:
I have a more in depth description of this on my blog.