I am using the PivotViewer v2 released with Silverlight 5. I've started to use the new data binding ability of the PivotViewer, binding directly to data objects that are passed down from the server, and using an ItemTemplate to display the objects in the PivotViewer.
With CXML, I could pre-generate the DZCs/DZIs for the pivot viewer (it's a JIT collection), but I can't figure out how to use Deep Zoom imaging + the new Pivotviewer with data binding. How can I display a deep zoom image in an item template for a collection that is data bound?
I've tried using the PivotViewerMultiSizeImage class (XAML below) and the PivotViewerMultiScaleSubImageHost class. My example below almost works: it displays an image, but seems to be stuck at the 100 pixel level - no Deep Zoom. I've also tried the MultiScaleImage control with DZIs, but no luck - it generates an OutOfMemory exception immediately.
Does anyone know how to get Deep Zoom capability with data binding in the new PivotViewer?
<pivot:PivotViewer.ItemTemplates>
<pivot:PivotViewerItemTemplate>
<pivot:PivotViewerMultiSizeImage Width="100" Height="100">
<pivot:PivotViewerMultiSizeImage.Sources>
<pivot:PivotViewerMultiSizeImageSource MaxHeight="100" MaxWidth="100" UriSource="{Binding Images[2]}" />
<pivot:PivotViewerMultiSizeImageSource MaxHeight="300" MaxWidth="300" UriSource="{Binding Images[3]}" />
<pivot:PivotViewerMultiSizeImageSource MaxHeight="500" MaxWidth="500" UriSource="{Binding Images[4]}" />
<pivot:PivotViewerMultiSizeImageSource MaxHeight="700" MaxWidth="700" UriSource="{Binding Images[5]}" />
<pivot:PivotViewerMultiSizeImageSource MaxHeight="20000" MaxWidth="20000" UriSource="{Binding Images[6]}" />
</pivot:PivotViewerMultiSizeImage.Sources>
</pivot:PivotViewerMultiSizeImage>
</pivot:PivotViewerItemTemplate>
</pivot:PivotViewer.ItemTemplates>
You're getting a 100x100 image because you are specifying this as the size of your control. Change the size of
<pivot:PivotViewerMultiSizeImage Width="100" Height="100">
to
<pivot:PivotViewerMultiSizeImage Width="2000" Height="2000">
or something big enough to cause the largest image to show. Also, I'm not sure if this matters or not, but I didn't put a MaxHeight/MaxWidth on my largest image.
This worked for me, thanks for halfway figuring this out because you lead me down the right path to getting deep zoom like functionality with databinding!