Geeks With Blogs

News Opinions and articles on this blog are mine alone and do not represent my employer. All articles and blog entries are posted using a personal computer system outside of my employer network.
Sam Abraham Software Engineer/Architect: Putting Customers First
I have been playing with the Windows Phone 7 Toolkit all day long (Saturday), all while reading Charles Petzold’s eBook brought to us for free by Microsoft Press.
 
Time for this 1013-page book couldn’t have been better as it provides us with insights into WP7 development right at the time WP7 phones are becoming available to consumers.
 
We greatly appreciate and acknowledge the cost Microsoft must have incurred and the big time sacrifice Charles must have made to get that high quality book publicly available in record time.
 
As I am working on our first Windows Phone 7 Application, we decided to encapsulate a functional area as a Windows Phone User Control and to include a Panorama control within. Online articles consistently demonstrated the Panorama control when defined in a Windows Phone Panorama Page. Additionally, the Panorama control is not available in the Toolbox for easy inclusion in a custom control.
 
In playing a bit with the Panorama control, I found a quick way to include it in our Windows Phone Control page without investing much effort:
 
1-Add a new Windows Phone Panorama Page to project. This will automatically add references to Microsoft.Phone.Interop, Microsoft.Phone.Controls in addition to the Microsoft.Pone DLL already referenced by default.
 
2-Copy the generated namespaces from Windows Phone Panorama Page to User Control XAML page.
 

    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"

    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"

    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"

    xmlns:mc=http://schemas.openxmlformats.org/markup-compatibility/2006

 
3-Copy the generated Panorama control XAML markup from the Windows Phone Panorama Page to the location desired within the Windows Phone User Control XAML.
 

        <controls:Panorama Title="my application">

 

            <!--Panorama item one-->

            <controls:PanoramaItem Header="item1">

                <Grid/>

            </controls:PanoramaItem>

 

            <!--Panorama item two-->

            <controls:PanoramaItem Header="item2">

                <Grid/>

            </controls:PanoramaItem>

        </controls:Panorama>

 
4-Delete the Windows Phone Panorama page created in step 1 since we didn’t need it in the first place.
 
5-Ask a friend to pat you on the back for being so efficient and quick.
 
--Sam Abraham
 
Posted on Sunday, November 7, 2010 1:50 AM Fladotnet.com , Tech Talk , VS2010 , Silverlight , Windows Phone 7 , WP7 | Back to top


Comments on this post: Adding a Windows Phone 7 Panorama Control inside a Windows Phone User Control

No comments posted yet.
Your comment:
 (will show your gravatar)


Copyright © Sam Abraham | Powered by: GeeksWithBlogs.net | Join free