Adventures with PivotViewer Part 6: Pimp it sample code

 

So let’s continue where the last post left off and finish the high-level pimping of the PivotViewer control…

If you want to follow along then you need to locate the PivotViewerSample code that shipped with the control. By default it is here for the August 2010 release:

C:\Program Files (x86)\Microsoft SDKs\Silverlight\v4.0\PivotViewer\Aug10\Source\PivotViewerSampleXapCode.zip

In the previous post the sample code showed you how to hide the left side Filters Panel and the right side Info Panel. It showed you also how to alter the background to help brand the control’s appearance.

The original code was a bit raw so I have put together a small demo application that wraps the functionality up into the custom PivotViewer class override. The sample allows you to toggle the Visibility of the tiles as well as the filters and information panels.

The custom properties can simply be used as in this sample:

...
if (PivotViewer.TileVisibility == Visibility.Visible)
{
PivotViewer.TileVisibility = Visibility.Collapsed;
}
else
{
PivotViewer.TileVisibility = Visibility.Visible;
}

C# Sample: Hide/Show the collection tiles

And the background can be set to ImageBrush like this:

...
// Main tile view background - ImageBrush
StreamResourceInfo sr = Application.GetResourceStream(new Uri("PimpThePivotViewer;component/Resources/Island.jpg", UriKind.Relative));
BitmapImage bmp = new BitmapImage();
bmp.SetSource(sr.Stream);
PivotViewer.GridBackground = new ImageBrush() { ImageSource = bmp };
sr.Stream.Close();

C# Sample: ImageBrush

The sample has a button to toggle the background between:

  • SolidColorBrush = Colors.Black
  • SolidColorBrush = Colors.Transparent
  • RadialGradientBrush
  • LinearGradientBrush
  • ImageBrush

    You can try out the sample Silverlight application here:
    Pimp-the-PivotViewer

    Here is the source code for you to play with, if you find it useful, let us know. We have extended the PivotViewer control in other ways to.

    Pimp-the-PivotViewer source code ZIP.

    Yoga Exercise collection with custom PivotViewer Ypga Theme applied

    PivotViewer Yoga Theme

    Advertisements
  • 12 responses to “Adventures with PivotViewer Part 6: Pimp it sample code

    1. Pingback: Tweets that mention Adventures with PivotViewer Part 6: Pimp it sample code | Xpert360 Ltd Development Blog -- Topsy.com

    2. great series!!!!!! keep them coming, i dying to see how you put the buttons in the viewer. curiosity is killing me..

    3. Pingback: Adventures with PivotViewer Part 9: Multi-Layered Trading Cards | Xpert360 Ltd Development Blog

    4. Pingback: Adventures with PivotViewer Part 8: Filter pane tooltips | Xpert360 Ltd Development Blog

    5. Pingback: Xpert360 PivotViewer Blog Article Index | Xpert360 Ltd Development Blog

    6. It is great! Can you please load the source code again, it will be very useful.

    7. Thank you very much, you are realy fast.

    8. It seems the source is missing again. Should the link above work?

    9. The source code is missing again, I’ve been trying for days…

    10. Hello.
      I thing this page is very useful for me , but the source download it failed.
      Can you update the source code? Thank you very much! : )

    Leave a Reply

    Fill in your details below or click an icon to log in:

    WordPress.com Logo

    You are commenting using your WordPress.com account. Log Out / Change )

    Twitter picture

    You are commenting using your Twitter account. Log Out / Change )

    Facebook photo

    You are commenting using your Facebook account. Log Out / Change )

    Google+ photo

    You are commenting using your Google+ account. Log Out / Change )

    Connecting to %s