Page-Turn Framework Updated for Silverlight 2

14 Comments October 29, 2008

I just returned home from the PDC after a marvelous few days in sunny L.A. Sunday's Silverlight precon was a blast, and if you attended, I hope you felt it was worth your time. I could have easily filled out two more days with Silverlight fun and games, but I tried to hit the high points in the time we had together.

I spent my time on the airplane to and from L.A. updating my page-turn framework for Silverlight 2. The original framework utilized Silverlight 1.0 and was introduced in the May 2008 issue of MSDN Magazine. The new version features the same basic API with a few tweaks and additions. For example, the PageTurn class now fires a PageTurned event each time a page turn is complete, making it easy to update the UI around the page-turn canvas each time the user flips a page. Here's a sample built around the new framework:


You can download the sample code here, or view the app online here. The page-turn framework is implemented in PageTurn.cs, and you can see how to use the framework by perusing Page.xaml and Page.xaml.cs. The XAML structure is the same as described in the aforementioned MSDN Magazine article.

I still need to do some cleaning-up in the code and would also like to add a few more features. But since the framework's in decent shape as is, and since I have promised publicly to update it for Silverlight 2, I didn't want to wait any longer to push the bits out there. If you have comments, questions, or suggestions (or, heaven forbid, find any bugs), be sure to let me know.


  • Gravatar Image
    Community Blogs October 30, 2008 1:30 AM

    In this issue: Jeff Handley, David Anson, Jafar Husain, Justin Angel, Beatriz Stollnitz, Scott Barnes

  • Gravatar Image
    David Roh October 30, 2008 3:14 PM

    Very nice Jeff - thank you very much for sharing this.

    David Roh

  • Gravatar Image
    Dan Ryan November 3, 2008 11:16 AM

    Hello Jeff: Great precon session; I actually liked it better than PDC itself. Anyway, I cannot for the life of me remember the uri you gave for your web demos (something like webdemo1.aspx). Can you pass it along? Thanks again for the great session... -Dan

  • Gravatar Image
    jprosise November 4, 2008 2:21 AM

    Dan, you can download my PDC demos from

  • Gravatar Image
    Trevor STreeton November 5, 2008 1:14 AM

    The demo I saw on was super. I downloaded it, unzipped it and tried to run it, but it never finishes loading.

  • Gravatar Image
    Steven James December 16, 2008 4:19 PM

    An ability to print a page or a section of pages.
    An ability to search to the first page with a word in it.
    An ability to have a Table of Contents.

  • Gravatar Image
    o UAU nosso de cada dia February 5, 2009 8:42 AM

    já havia um “page turner” em Silverlight 1.0, mas com a versão 2.0 o desempenho ficou ainda melhor.  

  • Gravatar Image
    Harald Mejlholm August 9, 2009 5:48 AM

    Is it possible to modify the GoToSpread-method so that it turns the page in the same nice way, that it does when I do it manually?

  • Gravatar Image
    jprosise August 9, 2009 7:54 AM

    Yes, although it'll require some work. I intend to update the framework to take advantage of some SL3 features such as animation easing. Maybe when I update it I can add an "automatic paging" feature.

  • Gravatar Image
    Jim Banghart January 5, 2010 4:44 PM

    At work, I was approached about putting our inhouse phone directory on our intranet web site. Ok, no prob. Then it was mentioned about how cool it would be if it actually looked like a book.

    Ok, I told them I didn't think this would be nontrivial, but I'd look around.

    Came across your pageturn stuff for silverlight. I see now that you've updated it, but I've been digging into your original stuff for a couple of weeks now.

    So, my question is could you give me a small sample javascript to load page 3 of your included booklette.

    I can create the images from a sql database and zip them up, but I just can't figure out how to go to a specific page.


  • Gravatar Image
    jprosise January 7, 2010 7:36 AM

    Version 2 of the framework (the C# version) has a GoToSpread method for doing exactly that. You could either use version 2 or port that method to JavaScript. You really should use v2; it's nicer and cleaner!

  • Gravatar Image
    Jim Banghart January 13, 2010 12:46 PM

    I blame it all on the cold medicine. Took a long look at the code again and figured out my error. So I've got it working now.

    Does version 2 work on Macs? I have downloaded it and have it running, but when I look thru the directories I see a dll. The mac I can test on has an older version of OS 10 that won't load silverlight. Still waiting to use somebody's newer mac for testing version 2.

  • Gravatar Image
    bowser June 8, 2010 1:21 PM

    This is a great framework, thanks for that.

    Little optimization if you have a lot of pages:

    If you have a lot of pages (>40 double pages) the cpu uses is quite high on page turn. I have changed the framework so that only the visible pages and one before and after are visible. The other pages are always collapsed. The cpu usage is then a lot better.

    So if you plan to use this framewrok for a lot of pages this may help you.

  • Gravatar Image
    CEMF September 30, 2010 4:42 PM

    Excelent framework. I am new in all this things, i'm trying to add new pages but i can't. I already added 2 extra canvas in the XAML and modified the the .cs, but when i run it, there is a error in the InitializeComponent(). I hope you could help me. Best Regards

Have a Comment?